这是一个随页面浮动广告的代码,但只是左侧的,我想在由侧也做一个一样的,可广告图片能出现,就是不能浮动,哪位高人能说一下右侧的怎么做啊!
ad.js文件内容:
document.write("<div id='FixAD' style='position:absolute; z-index:10;left:890;top:20;'><a href='http://www.3687web.net' target='_blank'><img src='images/ad.gif' border=0 alt='3687网页模板'></a></div>");浮动功能代码:
<script LANGUAGE="Javascript" src="ad.js"></script> 
<script LANGUAGE="Javascript">
<!-- Begin
var imgheight
var imgleft
document.ns = navigator.appName == "Netscape"
if (navigator.appName == "Netscape")
{
imgheight=document.FixAD.pageY
imgleft=document.FixAD.pageX
}
else
{
imgheight=600-parseInt(FixAD.style.top)
imgleft=parseInt(FixAD.style.left)
}
myload()
function myload()
{
if (navigator.appName == "Netscape")
{document.FixAD.pageY=pageYOffset+window.innerHeight-imgheight;
document.FixAD.pageX=imgleft;
leftmove();
}
else
{
FixAD.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
FixAD.style.left=imgleft;
leftmove();
}
}
function leftmove()
{
if(document.ns)
{
document.FixAD.top=pageYOffset+window.innerHeight-imgheight
document.FixAD.left=imgleft;
setTimeout("leftmove();",50)
}
else
{
FixAD.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
FixAD.style.left=imgleft;
setTimeout("leftmove();",50)
}
}function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true)
// End -->
</script>

解决方案 »

  1.   

    其实很多功能的实现可以用很简短的代码:
    <DIV  align="left" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; FILTER: progid:DXImageTransform.Microsoftpadding:8px; ;  BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; POSITION: absolute; ; TOP: expression(eval(document.body.scrollTop)+eval(document.body.clientHeight)-500); TEXT-ALIGN: center; height: 338; width: 55; left: 0px; top: 119px;">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="55" height="338">
        <param name="movie" value="1.swf">
        <param name="quality" value="high">
        <embed src="1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="55" height="338"></embed>
      </object>
    (这段加的是flash,也可以换作图片)
    </DIV>
      

  2.   

    呵呵,现在才知道哦?左右2边都只需要很短的代码就可以实现,而且就只改部分代码!
    div+css是个不错的玩意