签写留言时头相头像选择的一段javascript代码:(很有用的哦)
function showimage(value)
{
if(value!= '') {
document.images.useravatars.src='images/'+value;
} else{
document.images.useravatars.src='images/none.gif';
}
}
对应的HTML语句的书写:
<select name="face" onChange='showimage(this.options[this.selectedIndex].value)'>
<option value="f01.gif" >boy1</option>
<option value="f02.gif">boy2</option>
<option value="f07.gif" selected>boy7</option>
</select>
<img name=useravatars src='images/f07.gif' height=100 width=100 border=0>
效果查看:
http://free1.e-168.cn/huqing/guestbook/write.php
本文地址:http://com.8s8s.com/it/it25088.htm