点击IE退回 按钮后 ,为什么图片不显示了?? 因为你是通过javsscript改它的src,退回之后img的src就还原了,等同你点刷新一样,也会还原的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <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文档载入完成后执行的函数 每次都加载图片 <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的做法 Ext中的combobox,选择完,后台读不到数据=.= EXTJS 循环一个列表 奇怪的变量丢失 jquery+ajax+.net 三级联动 找个专家帮忙改造一下 用js怎么返回一个iframe 的left 和top值啊? js如何实现日期格式转换?急~ 关于鼠标移入移出层的问题 怎么样设置首行缩进??急,在线等!! 关于批量录入的问题? 怎样在子窗口中判断父窗口是否已经关闭? float与position可以同时用吗 请教请教~~~~~~~~~~~~~~·
<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文档载入完成后执行的函数 每次都加载图片
<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的做法