因为你是通过javsscript改它的src,退回之后img的src就还原了,等同你点刷新一样,也会还原的。

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <script type="text/javascript" src="../jquery/jquery.js"></script>
        <script type="text/javascript">
            $(function(){
                 if($("select").val()!="")
                    $("#img").attr("src",$("select").val());
                 else
                    $("#img").attr("src","初始图片地址' ");
            })
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        <select onchange="if(this.value!='') document.getElementById('img').src=this.value; else document.getElementById('img').src='初始图片地址' "> 
        <option value="">选择图片 </option> 
        <option value="http://www.google.cn/intl/zh-CN/images/logo_cn.gif">one </option> 
        <option value="http://www.baidu.com/img/baidu_logo.gif">two </option> 
        <option value="http://www.csdn.net/images/newcsdnlogo.gif">three </option> 
        </select> 
        <br/> 
        <img id="img" name="img" src="" border="0"/>     <a href="http://www.google.com">去GOOGLE.COM,然后点击 IE 工具栏 退回 </a>
        </div>
        </form>
        
    </body>
    </html> jquery写的 就是绑定一个在DOM文档载入完成后执行的函数 每次都加载图片
      

  2.   


    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <script type="text/javascript">
            function kaka(){
                if(document.getElementById("myselect").value!='')
                    document.getElementById('img').src=document.getElementById("myselect").value;
                else 
                    document.getElementById('img').src='图片'
            }        window.onload=kaka;
            
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        <select id="myselect" onchange="if(this.value!='') document.getElementById('img').src=this.value; else document.getElementById('img').src='图片' "> 
        <option value="">选择图片 </option> 
        <option value="http://www.google.cn/intl/zh-CN/images/logo_cn.gif">one </option> 
        <option value="http://www.baidu.com/img/baidu_logo.gif">two </option> 
        <option value="http://www.csdn.net/images/newcsdnlogo.gif">three </option> 
        </select> 
        <br/> 
        <img id="img" name="img" src="" border="0"/>     <a href="http://www.google.com">去GOOGLE.COM,然后点击 IE 工具栏 退回 </a>
        </div>
        </form>
        
    </body>
    </html>补充个javascript的做法