Javascript 图像缩略图未加载,鼠标悬停在图像上时,我的图像会上移吗?
?我上传到测试的网站有问题。当在Dreamweaver cs6中本地检查它们时,它们都可以正常工作,但是当上传它们时,滚动图像您将看到问题,当悬停在德克萨斯长角图像上时,出现问题,并且密歇根州图像没有加载任何人看到我的错误 以下是重要的代码,感谢您的帮助和网站页面的链接Javascript 图像缩略图未加载,鼠标悬停在图像上时,我的图像会上移吗?,javascript,html,Javascript,Html,?我上传到测试的网站有问题。当在Dreamweaver cs6中本地检查它们时,它们都可以正常工作,但是当上传它们时,滚动图像您将看到问题,当悬停在德克萨斯长角图像上时,出现问题,并且密歇根州图像没有加载任何人看到我的错误 以下是重要的代码,感谢您的帮助和网站页面的链接 功能更改图像(a){ document.getElementById(“img”).src=a; } 我不知道你在描述什么问题,但我猜是悬停延迟。使用javascript预加载程序或将它们加载到一个div中,样式沿{posi
功能更改图像(a){
document.getElementById(“img”).src=a;
}
{position:absolute;left:-999em;}
行,以使它们远离屏幕。这使得图像在悬停时立即可用,通常在下载图像时会出现延迟你能分享你上传网站的链接吗?这段代码帮不上什么忙。是的,很抱歉,忘了把链接放在你的问题中,这样人们就不必去寻找了。
<script type="text/javascript">
function changeImage(a) {
document.getElementById("img").src=a;
}
</script>
<div id="main_img">
<img id="img" src="images/placeholder.jpg"/>
</div>
<div id="thumb_img">
<img src='images/notredamelogo.JPG' width="200" height="150" onmouseover='changeImage("images/notredame.JPG");'>
<img src="images/ohiostatelogo.jpg" onmouseover='changeImage("images/ohiostate.jpg");'>
<a href="product_display_michigan.html"><img src='images/michiganstatelogo.jpg' onmouseover='changeImage("images/michiganstate.jpg");'></a>
<a href="product_display_template.html"><img src='images/floridagatorslogo.jpg' onmouseover='changeImage("images/floridagators.jpg");'></a>
<a href="index.html"><img src='images/texaslonghornslogo.jpg' onmouseover='changeImage("images/texaslonghorns.jpg");'></a>
</div>