<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>
1、问题:document.images.showimages.src="<%=imdeximg%>"是什么意思?干什么用的?我怎么从资料中查不到“showimages”个属性方法啊。
2、问题:document.form.sex.options[document.form.sex.selectedIndex].value是什么意思?干什么用的?怎么有options呢?
3、问题:document.form.img.options[document.form.img.selectedIndex].value+".gif"是什么意思?啊。。
谢谢,打完给分
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>
1、问题:document.images.showimages.src="<%=imdeximg%>"是什么意思?干什么用的?我怎么从资料中查不到“showimages”个属性方法啊。
2、问题:document.form.sex.options[document.form.sex.selectedIndex].value是什么意思?干什么用的?怎么有options呢?
3、问题:document.form.img.options[document.form.img.selectedIndex].value+".gif"是什么意思?啊。。
谢谢,打完给分
是id为showimages的图片控件的src属性
2.=后的全是赋值
3.<%= %>部分是靠服务器解释的
4.document.form.sex.options[document.form.sex.selectedIndex].value和下面那个差不多.
都是指拿到sex和img这两个select控件的选中项的值
<%=imdeximg%>"//这是jsp或者asp等取出的一个变量值给了上面那图片的路径二、document.form.sex.options//获得name等于sex的下拉菜单中的所有options即所有下拉子菜单
[document.form.sex.selectedIndex].value//然后这是获得当前被选中的下拉菜单的值.三、document.form.img.options[document.form.img.selectedIndex].value+".gif"
//跟上面一样,它后面加了个.gif肯定之前获得的是一个当前被选中的下拉菜单列表的值
而这个值是你WEB应用中的图片路径,所以加个.gif后缀.
document.images有很多中取法
document.images[index/element-id]
或document.images.elementId
或直接elementId
这样跟你说:=号左边document.images.showimages.src是名为showimages的图片的src属性
=号右边是设置这个属性的具体值,这里是个图片路径,sex和img都是2个select吧,获取选中的option的value
就是document.form.sex.options[document.form.sex.selectedIndex].value这样来做
<%=imdeximg%>"//这是jsp或者asp等取出的一个变量值给了上面那图片的src属性 二、document.form.sex.options//获得name等于sex的下拉菜单中的所有options即所有下拉子菜单
[document.form.sex.selectedIndex].value//然后这是获得当前被选中的下拉菜单的值.三、document.form.img.options[document.form.img.selectedIndex].value+".gif"
//跟上面一样,它后面加了个.gif肯定之前获得的是一个当前被选中的下拉菜单列表的值
而这个值是你WEB应用中的图片路径,所以加个.gif后缀.
直译过来就是根据不同的性别列出不同的小图片,供浏览者选择