日期:2014-05-17  浏览次数:20778 次

超链接引用变量问题,document.write将重写整个页面?
<form   name=form1>
<select   name=sel1   id=class1>  
<option   value= "zzz "> 111 </option>  
<option   value= "222 "   selected   > 222 </option>  
</select>
</form>

<SCRIPT   LANGUAGE=vbscript   for= "sel1 "   event= "onchange ">
a=form1.sel1.value
</SCRIPT>

<a   href= "http://192.168.51.178/userlist.asp?userlist=???> 123123123 </a>

怎样使得???部分随onchange事件a的值改变而随之改变?

之前使用了document.write但是整个页面被重写,只显示超链接部分列表框被删除了,虽然可用但是破坏了页面结构


------解决方案--------------------
<form name=form1>
<select name=sel1 id=class1 onChange= "setValue(this) ">
<option value= "zzz "> 111 </option>
<option value= "222 " selected > 222 </option>
</select>
</form>

<SCRIPT>
function setValue(obj)
{
document.getElementById( "aHref ").href = "http://192.168.51.178/userlist.asp?userlist= " +obj.value ;
}
</SCRIPT>

<a href= "http://192.168.51.178/userlist.asp?userlist=222 " id= "aHref "> 123123123 </a>