<script>
function showimage(){document.images.showimages.src="<%=imdeximg%>"+document.form.sex.options[document.form.sex.selectedIndex].value+""+document.form.img.options[document.form.img.selectedIndex].value+".gif";}
</script>
问题:这个函数实现的是“根据不同的性别列出不同的小图片,供浏览者选择.”的功能。但是怎么用啊,直接调用该函数就可以显示图片吗?给个例子
function showimage(){document.images.showimages.src="<%=imdeximg%>"+document.form.sex.options[document.form.sex.selectedIndex].value+""+document.form.img.options[document.form.img.selectedIndex].value+".gif";}
</script>
问题:这个函数实现的是“根据不同的性别列出不同的小图片,供浏览者选择.”的功能。但是怎么用啊,直接调用该函数就可以显示图片吗?给个例子
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<% string imdeximg = "images/"; %>
<script type="text/javascript">
function showimage(){
document.images.showimages.src="<%=imdeximg%>"+document.form.sex.options[document.form.sex.selectedIndex].value+""+document.form.img.options[document.form.img.selectedIndex].value+".gif";
//alert("<%=imdeximg%>"+document.form1.sex.options[document.form1.sex.selectedIndex].value+""+document.form1.img.options[document.form1.img.selectedIndex].value+".gif");
} </script></head>
<body>
<form id="form1" runat="server">
<select id="sex">
<option value="0">0</option>
<option value="1">1</option>
</select>
<select id="img">
<option value="0">0</option>
<option value="1">1</option>
</select>
<img id="showimages" src="" /><input id="Button1" type="button" value="button" onclick="showimage();" />
</form>
</body>
</html>