-
2008-01-10让广告代码不再影响你的网页加载速度 - [代码]
做一些联盟广告时,由于联盟广告的加载慢,整体页面的显示速度也会变慢,如果加入下面的代码就可以有效地解决这个问题。以下代码同时兼容IE和FireFox浏览器。
第一步:把这段代码放在你要放广告的网页位置:
<div id="myads">广告载入中...</div>
第二步:把这段代码放到页底:
<div id="span_myads">
这里放广告的JS代码或其他加载速度比较慢的内容都可以。
</div>
<script type="text/javascript">
document.getElementById("myads").innerHTML = document.getElementById("span_myads").innerHTML;
document.getElementById("span_myads").innerHTML = "";
</script>
本文来源于月光博客 http://www.williamlong.info , 原文地址:http://www.williamlong.info/archives/426.html -
<marquee bgcolor="#ffffff" behavior=scroll direction=up scrollamount=1 align="left" style="text-indent:0px; width:120px;height:30px;color:#CCCCCC; font-size: 12px"> 要滚动的内容 </marquee>
-
<strong>收藏到:</strong>
<a href="javascript:window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(document.title.substring(0,76))+'&iu='+encodeURIComponent(location.href)+'&fr=ien#nw=1','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); void 0" title="百度收藏">百度收藏</a><a href="javascript:window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)" title="QQ书签">QQ书签</a>
<a href="#" onclick="window.open('http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title), 'Yahoo','scrollbars=yes,width=780,height=550,left=80,top=80,status=yes,resizable=yes');">雅虎收藏</a>
<a href="javascript:location.href='http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)" target="_blank">Google书签</a><a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=28&title='+escape(d.title)+'&url='+escape(d.location.href)+'&desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();">新浪ViVi</a>
<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();">365Key</a><a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(yesky=window.open('http://hot.yesky.com/dp.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t)+'&st=2','yesky','scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes'));yesky.focus();">天极网摘</a>
<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://my.poco.cn/fav/storeIt.php?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t)+'&img=http://www.h-strong.com/blog/logo.gif','keyit','scrollbars=no,width=475,height=575,status=no,resizable=yes'));keyit.focus();">POCO网摘</a>
<a href="javascript:t=document.title;u=location.href;e=document.selection?(document.selection.type!='None'?document.selection.createRange().text:''):(document.getSelection?document.getSelection():'');void(open('http://bookmark.hexun.com/post.aspx?title='+escape(t)+'&url='+escape(u)+'&excerpt='+escape(e),'HexunBookmark','scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes'));">和讯网摘</a>
<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(blog=window.open('http://www.bolaa.com/CommendBlog/SmallLogin.aspx?title='+escape(d.title)+'&newspath='+escape(d.location.href)+'&subtitle='+escape(t),'bolaa','width=400px,height=400px'));blog.focus();">博拉推荐</a>
<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.cn3.cn/user/addurl.asp?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=490,height=450,left=120,top=50,status=no,resizable=yes'));keyit.focus();">天下图摘</a>
<a href="javascript:location.href='http://digg.com/submit?phase=2&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)" target="_blank">digg发现</a>
<a href="javascript:location.href='http://del.icio.us/post?&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)" target="_blank">Del.icio.us</a>
-
2007-10-20在网页中增加PPS视频播放器代码 - [代码]
如果您想在自己网站中加入网络电视/电影频道/体育直播,请参考以下方法,在您的网页中加入相关代码:
在网页中增加PPS播放器联盟代码 点击查看实例
- ·PPS播放器联盟既可以给你提供网络电视播放服务,又能把你的网站显示在其他联盟站点上,给你带来流量! 将以下代码粘贴在你的页面期望PPS出现的位置:
<script src=http://www.pps.tv/wslm/ppsu.js></script> <script> pps_SiteID="http://www.pps.tv/";//改成你的网站地址 pps_listWidth=208;//列表宽度 pps_listHeight=420;//列表高度 pps_playerWidth=470;//播放器宽度 pps_playerHeight=420;//播放器高度 ShowPPS();//显示播放器 </script>·添加PPS到你的网页以后,点此把你的网站提交到网视联盟,审核通过后即可获得其他网站给你的流量!在网页中加入PPSbar 点击查看实例
- 将以下蓝色代码粘贴在
</body>
后面。</body> <SCRIPT language="JavaScript" src="http://www.ppstream.com/ppsbar/ppsbar.js"></SCRIPT> <SCRIPT language="JavaScript"> document.onmousemove=Drag; document.onmouseup=StopDrag; </SCRIPT> </html>
- 把网页手动安装插件包放入你的网页,在网页任何位置加入下述javascript代码。
如果您无法正常看到相应频道列表,请在此 <a href="http://download.ppstream.com/powerplayersetup.exe" target="_blank"> <font color=red><b>安装最新版网络电视插件</b></font></a>
在网页插入播放器或架设直播间 点击查看实例
- 设置频道列表与播放器关联,在网页
<head>
和</head>
之间加入下述javascript代码。<script> window.onload=function() { powerlist.SetPlayer(powerplayer.getHWND()); } </script> - 把频道列表放入你的网页,在网页
<body>
和</body>
之间加入下述javascript代码。<OBJECT CLASSID="clsid:20C2C286-BDE8-441B-B73D-AFA22D914DA5" CODEBASE=http://download.ppstream.com/powerplayersetup.exe standby="加载频道列表中..." WIDTH=208 HEIGHT=460 ID="powerlist"> <!--大小可依网页需要调整--> </OBJECT>
- 把PPStream播放器放入你的网页,在网页
<body>
和</body>
之间加入下述javascript代码。<OBJECT CLASSID="clsid:5EC7C511-CD0F-42E6-830C-1BD9882F3458" CODEBASE=http://download.ppstream.com/powerplayersetup.exe standby="加载播放器中..." WIDTH=470 HEIGHT=460 ID="powerplayer"> <!--大小可依网页需要调整--> <param name="ShowControl" value="1"> <!--显示播放控制按钮,1为显示, 0为不显示--> <param name="src" value="ppstream://ppstream.com:9004/X7Y3ZPQPM37HGOMNVE6AA3CTG3MWASFU"> <!--频道地址可自由指定--> <param name="autostart" value="0"> <!--是否打开网页立即自动播放, 1为自动播放,0为不自动播放--> </OBJECT> 如果您无法正常看到相应频道列表,请在此 <a href="http://download.ppstream.com/powerplayersetup.exe" target="_blank" ><font color=red><b>安装最新版网络电视插件</b></font></a>
- 把网页手动安装插件包放入你的网页,在网页任何位置加入下述javascript代码。
如果您无法正常看到相应频道列表,请在此<a href="http://download.ppstream.com/powerplayersetup.exe" target="_blank" ><font color=red><b>安装最新版网络电视插件</b></font></a> <a href="http://www.ppstream.com/download.html" target="_blank" ><font color=red><b>PPStream网络电视</b></font></a>
网页其他部分请您自行进行美化设计,可参照在线体验页
- 将以下蓝色代码粘贴在
-
2007-10-20[转]给网页上的对象加上一个智能说明框 - [代码]
网页中的对象,如:链接、图片等,如果有说明框的话,将更能引起浏览者的注意。
一般情况下,我们都是用alt或title属性来实现的,这种方法简单,无须编写脚本,但显示时间短,无法自定义样式,且在对象上不能随鼠标的移动而移动,所以常常让设计者感到美中不足。
在这种情况下,我写了一段代码,使用了DIV来代替说明框,使用了自定义属性来代替框中的内容。从效果上大家就可以看出来。这段代码的优越性:
只使用了一个DIV(样式随便定义),哪个对象需显示说明框,无须定义ID,只须定义属性xxx="..."即可(如果...从库内读出,岂不...),通用性、可移植性强...
<script language="JavaScript">
document.onmouseover=function(){showdiv();}//显示DIV
document.onmousemove=function(){if(odiv.style.visibility=='visible') setpos();}//移动DIV
document.onmouseout=function(){odiv.style.visibility='hidden';
}//隐藏DIV
function showdiv() {
if(event.srcElement.xxx && event.srcElement.xxx!=''){
setpos();
odiv.innerText=event.srcElement.xxx;
odiv.style.visibility='visible';
}
}
function setpos(){//设置DIV的位置及DIV样式中阴影的方向
if (odiv.offsetWidth+event.x >= document.body.offsetWidth) {
odiv.style.left=document.body.scrollLeft+event.x-odiv.offsetWidth;
x='l';//向左
}
else {
odiv.style.left=document.body.scrollLeft+event.x;
x='r'//向右
}
if (odiv.offsetHeight+event.y+18 >= document.body.offsetHeight) {
odiv.style.top=document.body.scrollTop+event.y-odiv.offsetHeight;
y='u';//向上
}
else {
odiv.style.top=document.body.scrollTop+event.y+18;
y='d';//向下
}
if (x+y=='lu') n=-45;//左上
if (x+y=='ru') n=45;//右上
if (x+y=='ld') n=-135;//左下
if (x+y=='rd') n=135;//右下
odiv.style.filter='progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=' + n + ')';
}
</script>
<body style="cursor:default">
<div id="odiv" style="visibility:hidden;width:250;text-overflow:ellipsis;padding:5 5;border:1px solid #000000;background-color:#FFFFCC;font-size:12px;position:absolute;"></div>
<p style="background:yellow" xxx="这是一段文字
---------------------------------
由于有了自定义属性xxx,所以有了说明框!
注意不同位置下DIV阴影的方向:)">带说明框的文字</p>
<p>文字</p> <p>文字</p>
<a href="" xxx="这是一个超链接
---------------------------------
由于有了自定义属性xxx,所以有了说明框!
注意不同位置下DIV阴影的方向:)">带说明框的超链接</a>
<p>文字</p> <p>文字</p>
<img src="images/logo.gif" border="1" xxx="这是一个图片
---------------------------------
由于有了自定义属性xxx,所以有了说明框!
注意不同位置下DIV阴影的方向:)">
<p>文字</p> <p>文字</p>
<p style="background:yellow" xxx="这是一段文字
---------------------------------
由于有了自定义属性xxx,所以有了说明框!
注意不同位置下DIV阴影的方向:)">带说明框的文字</p>






