当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 多浏览器兼容的右下角广告代码(已测)

Javascript
Add a Table to a Word Document
Add Formatted Text to a Word Document
用jscript实现新建word文档
用jscript实现新建和保存一个word文档
Open and Print a Word Document
Use Word to Search for Files
Convert Seconds To Hours
Sample script that deletes a SQL Server database
Sample script that displays all of the users in a given SQL Server DB
firefox中用javascript实现鼠标位置的定位
div+css实现鼠标放上去,背景跟图片都会变化。
Locate a File Using a File Open Dialog Box
Save a File Using a File Save Dialog Box
用jscript实现列出安装的软件列表
List the Stored Procedures in a SQL Server database
Display SQL Server Login Mode
Display SQL Server Version Information
List all the Databases on a SQL Server
用jscript启动sqlserver
Stop SQL Server

Javascript 中的 多浏览器兼容的右下角广告代码(已测)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 201 ::
收藏到网摘: n/a

支持FIREFOX IE7 IE6 周未就为了这个小效果,折腾死人了!找了很多的代码都不行,不是不支持FIREFOX,就是对HTML和XHTML有要求! 查了N多的资料,现在终于解决了,MD,自已写了一个,代码很简单!在FIREFOX IE7 IE6中我测了,没有问题,我想有很多都也在找这样的代码,贴出来和大家分享吧!
复制代码 代码如下:

<div style="position:absolute;border:1px solid #000;right:0;" id="ad"><a href="http://www.zishu.cn">子鼠测试.</a></div>
//这一行写了这个DIV是绝对定位,最好再加一下z-index;边框为1px的实线黑色边;距右边有0PX; ID=AD;
<script language="JavaScript" type="text/javascript">
function rightBottomAd(){
var abc = document.getElementById("ad");
abc.style.top = document.documentElement.scrollTop+document.documentElement.clientHeight-20+"px";//20是这个层的高度;
setTimeout(function(){rightBottomAd();},50);
}
rightBottomAd();
</script>

点击运行可以看到效果:
[Ctrl+A 全选 提示:你可先修改部分代码,再按运行]