日期:2014-05-20  浏览次数:20464 次

asp.net中的一段javascript代码求解!!
addword.ascx页面:

代码如下:

  <script   language= "JavaScript "   type= "text/javascript ">
function   changeimage()
{  
window.document.form1.showimage.src=document.form1.Addword1$guestPic.value;
}

<select   name= "guestPic "   id= "guestPic "   onchange= "changeimage() "   runat= "server ">
                    <option   value= "..\Image\man\01.gif "> 01 </option>
                    <option   value= "..\Image\man\02.gif "> 02 </option>
                    <option   value= "..\Image\man\03.gif "> 03 </option>
                    <option   value= "..\Image\man\04.gif "> 04 </option>
...
<img   src= "../Image/man/01.gif "   alt= " "   width= "80 "   height= "90 "   id= "showimage "   />

其中Addword1$guestPic名称为ascx插入到aspx页面所生成的控件名称.

此代码在ie中操作成功,在firefox更改选择项不能更改图片,请指教!!!

------解决方案--------------------
function changeimage()
{
//window.document.form1.showimage.src=document.form1.Addword1$guestPic.value;
document.getElementById( "showimage ").src=document.getElementById( "Addword1$guestPic ").value;
}