を
あなたもこれを試すことができます私はそれが完璧な方法かどうかはわかりませんが、それは仕事です
demo here
javascriptの
function mouseOver(ban_id)
{
if(ban_id=="flashdivb")
document.getElementById("flashdivb").className="flash-abgb";
else if(ban_id=="flashdivsb")
document.getElementById("flashdivsb").className="flash-abgsb";
}
function mouseOut(ban_id)
{
if(ban_id=="flashdivb")
document.getElementById("flashdivb").className="flash-ib";
else if(ban_id=="flashdivsb")
document.getElementById("flashdivsb").className="flash-isb";
}
HTML
<!--html code for the banner-->
<div class="banner">
<div class="bannerAd">
<img src="http://sitehelp.com.au/images/bannerad.png">
<a href="somelink.html">
<div id="flashdivb" class="flash-ib"></div>
</a>
<a href="/media">
<div class="ibhover" onmouseover="mouseOver('flashdivb')" onmouseout="mouseOut('flashdivb')"> </div>
</a>
</div>
</div>
<!--html code for the sidebar-->
<div class="sidebar">
<div class="sidebarAd">
<img src="http://sitehelp.com.au/images/sidebarad.png">
<a href="somelink.html">
<div id="flashdivsb" class="flash-isb"></div>
</a>
<a href="/media">
<div class="isbhover" onmouseover="mouseOver('flashdivsb')" onmouseout="mouseOut('flashdivsb')"> </div>
</a>
</div>
</div>
CSS
/*css for the banner*/
h3 { font-family:Arial, Helvetica, sans-serif;
color:#444444;
}
/*header advert*/
.banner {
width:468px;
height:60px;
border:1px solid #aaaaaa;
position:relative;
}
.bannerAd{
position:absolute;
top:0px;left:0px;
}
.flash-ib {
background-image: url("http://sitehelp.com.au/images/bannerinfo.png");
height: 60px;
width: 468px;
position:absolute;
top:0px;left:0px;
/*opacity:0.4;opacity option*/
}
.flash-abgb {
background-image: url("http://sitehelp.com.au/images/bannerinfolink.png");
height: 60px;
width: 468px;
position:absolute;
top:0px;left:0px;
/*opacity:0.8;opacity option*/
}
div.ibhover {
height: 20px;
width: 25px;
position: absolute;
top: 40px;
left: 443px;
}
/*css for the sidebar*/
.sidebar {
width:250px;
height:250px;
border:1px solid #aaaaaa;
position:relative;
}
.sidebarAd{
position:absolute;
top:0px;left:0px;
}
.flash-isb {
background-image: url("http://sitehelp.com.au/images/sidebarinfo.png");
height: 250px;
width: 250px;
position:absolute;
top:0px;left:0px;
/*opacity:0.4;opacity option*/
}
.flash-abgsb {
background-image: url("http://sitehelp.com.au/images/sidebarinfolink.png");
height: 250px;
width: 250px;
position:absolute;
top:0px;left:0px;
/*opacity:0.8;opacity option*/
}
div.isbhover {
height: 20px;
width: 25px;
position: absolute;
top: 230px;
left: 225px;
}
あなたがマットを編集したかわかりませんか? – 422
関数に一意の名前を付けるだけの理由がありますか?例えば 'mouseOverBanner'と' mouseOverSidebar'はありますか? – sdleihssirhc
もし私がどのように知っていたら、私は尋ねません..私はちょうどそれをする方法を知らない... – 422