09-11
27
XHTML 1.0 Transitional 下的网站对联式悬浮广告js代码
作者:Java伴侣 日期:2009-11-27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
网页头部如上述。
把下面这段代码保存为 adver-left.js
网页中是这样调用,注意修改 js 文件的路径
<SCRIPT src="js/adver-left.js"></SCRIPT>
<SCRIPT src="js/adver-right.js"></SCRIPT>
上面两段代码中的 src='swf/00001.swf' ,改为自己广告的flash的路径
<html xmlns="http://www.w3.org/1999/xhtml">
网页头部如上述。
把下面这段代码保存为 adver-left.js
复制内容到剪贴板 程序代码
var imgheight
var imgleft
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=100:imgheight=100
window.screen.width>800 ? imgleft=15:imgleft=122
function myload()
{
if (navigator.appName == "Netscape")
{document.myleft.pageY=pageYOffset+window.innerHeight-imgheight;
document.myleft.pageX=imgleft;
leftmove();
}
else
{
myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
myleft.style.left=imgleft;
leftmove();
}
}
function leftmove()
{
if(document.ns)
{
document.myleft.top=pageYOffset+window.innerHeight-imgheight
document.myleft.left=imgleft;
setTimeout("leftmove();",80)
}
else
{
myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
myleft.style.left=imgleft;
setTimeout("leftmove();",80)
}
}
if (navigator.appName == "Netscape")
{
document.write("<layer id=myleft top=300 width=80 height=88><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash' id=changhongout wmode='transparent'></EMBED></layer>");
myload()}
else
{
document.write("<div id=myleft style='position: absolute;width:80;top:150;left:5;visibility: visible;z-index: 1'><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash' id=changhongout wmode='transparent'></EMBED></div>");
myload()
}
把下面这段代码保存为 adver-right.js
var imgheight
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=100:imgheight=100
function myload()
{
if (navigator.appName == "Netscape")
{document.dangdang.pageY=pageYOffset+window.innerHeight-imgheight;
document.dangdang.pageX=+window.innerWidth-120;
mymove();
}
else
{
dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
dangdang.style.left=document.body.offsetWidth-120;
mymove();
}
}
function mymove()
{
if(document.ns)
{
document.dangdang.top=pageYOffset+window.innerHeight-imgheight;
document.dangdang.left=pageXOffset+window.innerWidth-120;
setTimeout("mymove();",50)
}
else
{
dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
dangdang.style.left=document.body.scrollLeft+document.body.offsetWidth-120;
setTimeout("mymove();",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)
if (navigator.appName == "Netscape")
{document.write("<layer id=dangdang top=300 width=80 height=88><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash'></EMBED></layer>");
myload()}
else
{
document.write("<div id=dangdang style='position: absolute;width:80;top:0;left:578;visibility: visible;z-index: 1'><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash'></EMBED></div>");
myload()
}
var imgleft
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=100:imgheight=100
window.screen.width>800 ? imgleft=15:imgleft=122
function myload()
{
if (navigator.appName == "Netscape")
{document.myleft.pageY=pageYOffset+window.innerHeight-imgheight;
document.myleft.pageX=imgleft;
leftmove();
}
else
{
myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
myleft.style.left=imgleft;
leftmove();
}
}
function leftmove()
{
if(document.ns)
{
document.myleft.top=pageYOffset+window.innerHeight-imgheight
document.myleft.left=imgleft;
setTimeout("leftmove();",80)
}
else
{
myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
myleft.style.left=imgleft;
setTimeout("leftmove();",80)
}
}
if (navigator.appName == "Netscape")
{
document.write("<layer id=myleft top=300 width=80 height=88><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash' id=changhongout wmode='transparent'></EMBED></layer>");
myload()}
else
{
document.write("<div id=myleft style='position: absolute;width:80;top:150;left:5;visibility: visible;z-index: 1'><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash' id=changhongout wmode='transparent'></EMBED></div>");
myload()
}
把下面这段代码保存为 adver-right.js
var imgheight
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=100:imgheight=100
function myload()
{
if (navigator.appName == "Netscape")
{document.dangdang.pageY=pageYOffset+window.innerHeight-imgheight;
document.dangdang.pageX=+window.innerWidth-120;
mymove();
}
else
{
dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
dangdang.style.left=document.body.offsetWidth-120;
mymove();
}
}
function mymove()
{
if(document.ns)
{
document.dangdang.top=pageYOffset+window.innerHeight-imgheight;
document.dangdang.left=pageXOffset+window.innerWidth-120;
setTimeout("mymove();",50)
}
else
{
dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
dangdang.style.left=document.body.scrollLeft+document.body.offsetWidth-120;
setTimeout("mymove();",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)
if (navigator.appName == "Netscape")
{document.write("<layer id=dangdang top=300 width=80 height=88><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash'></EMBED></layer>");
myload()}
else
{
document.write("<div id=dangdang style='position: absolute;width:80;top:0;left:578;visibility: visible;z-index: 1'><EMBED src='swf/00001.swf' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash'></EMBED></div>");
myload()
}
网页中是这样调用,注意修改 js 文件的路径
<SCRIPT src="js/adver-left.js"></SCRIPT>
<SCRIPT src="js/adver-right.js"></SCRIPT>
上面两段代码中的 src='swf/00001.swf' ,改为自己广告的flash的路径
[本日志由 blurxx 于 2009-11-27 11:30 AM 编辑]
文章来自: 本站原创引用通告: 查看所有引用 | 我要引用此文章
Tags: w3c标准 Transitional 悬浮
相关日志:
评论: 0 | 引用: 0 | 查看次数: 262
发表评论