点击按纽后 切换了图片 如果点不同的图片 如何跳转到不同的地址???
看看代码哪有问题?谢谢了
<img style="z-index:0" width="360px" height="230px" id=obj src ="../Images/netImages/dashiguan1.jpg" onclick="jumpPhoto()" /> <script>
function jumpPhoto()
{
var obj=document.getElementById("obj");
if(obj.src="../Images/netImages/dashiguan1.jpg")
{
window.location= "../Images/netImages/dashiguan1.jpg";
}
else if(obj.src="../Images/netImages/anye1.jpg")
{
window.location= "../Images/netImages/anye1.jpg";
}
} </script>
alert()了一下 路径都对 都是当前图片的路径 可是跳过去 还是显示第一张图。。
{
window.location= "../Images/netImages/dashiguan1.jpg";
}
else if(obj.src=="../Images/netImages/anye1.jpg")
{
window.location= "../Images/netImages/anye1.jpg";
}
if(obj.src=="http://localhost:7182/WebUI/Images/netImages/dashiguan1.jpg")
{
window.location= "../Images/netImages/dashiguan1.jpg";
}
else if(obj.src=="http://localhost:7182/WebUI/Images/netImages/anye1.jpg")
{
window.location= "../Images/netImages/anye1.jpg";
}
可是端口会变的啊...
if(src=="dashiguan1.jpg")
{
window.location= "../Images/netImages/dashiguan1.jpg";
}else if(src=="anye1.jpg"){
window.location= "../Images/netImages/anye1.jpg";
}