单击图像,更换一张图片,是这样写的吗?实在没分了
<img src= "images\newMessage.gif " OnClick= "this.src= 'images/sjlr.jpg ' ">
这样写onclick事件是对的吗?怎么没有反应呢?
谢谢!
------解决方案-------------------- <img src= "images\newMessage.gif " OnClick= "this.src= 'images/sjlr.jpg ' "> ,看看src= "images\newMessage.gif "和this.src= 'images/sjlr.jpg ',其中的两个斜杠怎么不一样呢,呵呵,后者应该是正确的,但可能是路径层次关系有问题,this.src= '../images/sjlr.jpg ',加../之类的试试看
------解决方案-------------------- <img id = "pic " alt = "t " src= "DSCF5712.jpg " height = "50px " width = "50px " onclick= "this.src= '2.jpg ' " />
------解决方案--------------------onclick= "this.src= 'imgpath ' "
------解决方案--------------------要是再不行 就编写一个函数:
<script type = "text/javascript " >
function pic_onclick()
{
if (confirm( "您确定么? "))
{
document.getElementById ( "pic ").src= "2.jpg ";
return true;
}
else
{
return false;
}
}
</script>
<img id = "pic " alt = "t " src= "DSCF5712.jpg " height = "50px " width = "50px " onclick= "return pic_onclick() " />
------解决方案--------------------在IE下正常,FF没反映