猿问

有两个广告条通栏。想实现效果当鼠标划过某个广告时该广告条放大。现在问题是无论划过哪个都是下面的放大!

<html>
<head>
<script type="text/javascript">

var ads_toggle = [2465, 2468];

var ads_autoshow = [];
var init_ads = function() {
if (ads_toggle.length > 0){
for (var i = 0; i < ads_toggle.length; i++){
var el = document.getElementById('ad_pos_' + ads_toggle[i]);
if (el) {
var oDiv_mouseout = el.getElementsByTagName("div")[1];

var oDiv_mouseover = el.getElementsByTagName("div")[0];

oDiv_mouseout.onmouseover = function(e){
oDiv_mouseout.style.display = 'none';
oDiv_mouseover.style.display = '';
}
oDiv_mouseover.onmouseover = function(e){
oDiv_mouseout.style.display = 'none';
oDiv_mouseover.style.display = '';
}
oDiv_mouseout.onmouseout = function(e){
oDiv_mouseout.style.display = '';
oDiv_mouseover.style.display = 'none';
}
oDiv_mouseover.onmouseout = function(e){
oDiv_mouseout.style.display = '';
oDiv_mouseover.style.display = 'none';
}
}
}
}
}

if (document.all) {
window.attachEvent("onload", function(){init_ads();});
} else {
window.addEventListener("load", function(){init_ads();}, false);
}
</script>

</head>
<body>

<div id="ad_pos_2465">
<div style="display:none;">
放大的内容!!!!!!!!!!!!
</div>

<div>
原来的内容
</div>
</div>


<div id="ad_pos_2468">
<div style="display: none;">
放大的内容!!!!!!!!!!!!
</div>
<div>
原来的内容
</div>
</div>


</body>
</html>

繁星coding
浏览 463回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答