网页顶部显示IE版本过低的代码
作者:plus 日期:2009-11-11
今天有人让我注册 www.eagleworldwide.com域名,结果被人注册,顺便看看人家的网站
一进去,上面大半截就是提示IE版过低的广告窗口,而且只提示一次啊,我立刻兴趣就来了,发掘它的源码,如下:
- /**
- * RokIEWarn - An IE6 Warning to invite people upgrading to IE6
- *
- * @version 1.2-noOpacity
- *
- * @license MIT-style license
- * @author Djamil Legato <djamil@rockettheme.com>
- * @client RocketTheme, LLC.
- * @copyright Author
- */
- var RokIEWarn = new Class({
- 'site': 'sitename',
- 'initialize': function() {
- var warning = "<h3>You are currently browsing this site with Internet Explorer 6 (IE6).</h3><h4>NOTE: This template is compatible with IE6, however your experience will be enhanced with a newer browser.</h4><p>Internet Explorer 6 was released in August of 2001, and the lastest version of IE6 was released in August of 2004. By continuing to run Internet Explorer 6 you are open to any and all security vulnerabilities discovered since that date. In March of 2009, Microsoft released version 8 of Internet Explorer that, in addition to providing greater security, is faster and more standards compliant than both version 6 and 7 that came before it. The overall usage of Internet Explorer 6 has decreased to such a point that 2009 will probably be the year in which web developers stop supporting it, so please upgrade as soon as possible. It's for your own good!</p> <br /><a class=\"external\" href=\"http://www.microsoft.com/windows/internet-explorer/?ocid=ie8_s_cfa09975-7416-49a5-9e3a-c7a290a656e2\">Download Internet Explorer 8 NOW!</a>";
- this.box = new Element('div', {'id': 'iewarn'}).inject(document.body, 'top');
- var div = new Element('div').inject(this.box).setHTML(warning);
- var click = this.toggle.bind(this);
- var button = new Element('a', {'id': 'iewarn_close'}).addEvents({
- 'mouseover': function() {
- this.addClass('cHover');
- },
- 'mouseout': function() {
- this.removeClass('cHover');
- },
- 'click': function() {
- click();
- }
- }).inject(div, 'top');
- this.height = $('iewarn').getSize().size.y;
- this.fx = new Fx.Styles(this.box, {duration: 1000}).set({'margin-top': $('iewarn').getStyle('margin-top').toInt()});
- this.open = false;
- var cookie = Cookie.get('rokIEWarn'), height = this.height;
- //cookie = 'open'; // added for debug to not use the cookie value
- if (!cookie || cookie == "open") this.show();
- else this.fx.set({'margin-top': -height});
- return ;
- },
- 'show': function() {
- this.fx.start({
- 'margin-top': 0
- });
- this.open = true;
- Cookie.set('rokIEWarn', 'open', {duration: 7});
- },
- 'close': function() {
- var margin = this.height;
- this.fx.start({
- 'margin-top': -margin
- });
- this.open = false;
- Cookie.set('rokIEWarn', 'close', {duration: 7});
- },
- 'status': function() {
- return this.open;
- },
- 'toggle': function() {
- if (this.open) this.close();
- else this.show();
- }
- });
- window.addEvent('domready', function() {
- if (window.ie6) { (function() {var iewarn = new RokIEWarn();}).delay(2000); }
- });
Tags: IE
73种网页常用js代码
作者:Darph 日期:2009-09-11
1、后退 前进
<input type="button" value="后退" onClick="history.go(-1)">
<input type="button" value="前进" onClick="history.go( 1 );return true;">
2、返回
<form><input type="button" value="返回上一步" onClick="history.back(-1)"></form>
3、查看源码
<input type="button" name="view" value="查看源码" onClick="window.location="view-source:" +window.location.href">
4、禁止查看源码
<body oncontextmenu="return false"></body>
5、刷新按钮一
<input type="button" value="刷新按钮一" onClick="ReloadButton()">
<script>function ReloadButton(){location.href="i001.htm";}</script>
刷新按钮二
<input type="button" value="刷新按钮二" onClick="history.go(0)">
6、回首页按钮
<input type="button" value="首页" onClick="HomeButton()">
<script>function HomeButton(){location.href=http://www.winliuxq.com;}</script>
7、弹出警告框
<input type="button" value="弹出警告框" onClick="AlertButton()">
<script>function AlertButton(){window.alert("要多多光临呀!");}</script>
8、状态栏信息
<input type="button" value="状态栏信息" onClick="StatusButton()">
<script>function StatusButton(){window.status="要多多光临呀!";}</script>
9、背景色变换
<form><input type="button" value="背景色变换" onClick="BgButton()"></form>
<script>function BgButton(){
if (document.bgColor=='#00ffff')
{document.bgColor='#ffffff';}
else{document.bgColor='#00ffff';}
}
</script>
10、打开新窗口
<input type="button" value="打开新窗口" onClick="NewWindow()">
<script>function NewWindow(){window.open("c01.htm","","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}
</script>
11、窗口最小化
<OBJECT id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><PARAM name="Command" value="Minimize"></OBJECT><button onClick="min.Click()">窗口最小化</button>
12、全屏代码
<input type="BUTTON" name="FullScreen" value="全屏显示" onClick="window.open(document.location, 'butong_net', 'fullscreen')">
13、关闭窗口
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><param name="Command" value="Close"></object><input type="button" value="关闭窗口" onClick="closes.Click();">
关闭窗口
<input type=button value=关闭窗口 onClick="javascript:self.close()">
14、最大化
<object id=big classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object><input type=button value=最大化 onClick=big.Click()>
15、关闭输入法
<input style="ime-mode:disabled" value=关闭输入法>
16、链接按钮1
<input type="button" value="链接按钮1" onClick="window.open('http://www.winliuxq.com/', 'Sample', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width=790,height=520,left=0,top=0')" name="input">
链接按钮2
<input type="BUTTON" NAME="Button" value="链接按钮2" onClick="showModalDialog('http://www.winliuxq.com/')">
链接按钮3
<input type="submit" value="链接按钮3" onClick="location.href='http://www.winliuxq.com/'">
17、警告框显示源代码
<BUTTON onClick=alert(document.documentElement.outerHTML) style="width:110">警告框显示源代码</BUTTON>
18、点击后按钮清空
<input type=button value='打印' onClick="this.style.visibility='hidden';window.print();">
19、打印
<input type=button value='打印' onClick="window.print();">
20、打印预览
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
<input type=button value=打印预览 onclick="wb.execwb(7,1)">
21、另存为
<input onClick="document.execCommand('saveas','true','常用代码.htm')" type=button value=另存为>
22、点击自动复制
<script>function oCopy(obj){obj.select();js=obj.createTextRange();js.execCommand("Copy")}</script>
<input type="text" value="点击自动复制" onClick="oCopy(this)" size="11">
23、自动选中
<input value="自动选中" onFocus="this.select()" onMouseOver="this.focus()" size="11">
24、打开源代码
<BUTTON onClick="document.location = 'view-source:' + document.location" size="7">打开源代码</BUTTON>
25、新窗口延迟打开
<input type=button value=新窗口延迟打开 onClick=javascript:setTimeout("window.open('http://www.winliuxq.com/')",10000)>
26、实现选中文本框里的前一半的内容
<input type="text" value="选中文本框里的前一半的内容" size=30 onmouseover="this.select();tR=document.selection.createRange();tR.moveEnd('character',-8);tR.select();">
<input type="text" value="选中部分内容,非IE可以用这个" size=30 onmouseover="this.selectionStart=this.value.length-4;this.selectionEnd=this.value.length">
27、点击清空文字
<input type="text" name="artist" size=14 value="点击清空文字" onmouseover=this.focus() onfocus=this.select() onclick="if(this.value=='点击清空文字')this.value=''">
点击清空文字
<input name=name size=11 value=点击清空文字 onMouseOver=this.focus() onblur="if (this.value =='') this.value='点击清空文字'" onFocus=this.select() onClick="if (this.value=='点击清空文字') this.value=''">
28、等于标题(title):
<input type="text" value="" id="aa" size="20">
<script>document.getElementById("aa").value=document.title;</script>
29、检测IE是否脱机
<input type="button" value="测试" onclick="alert(window.navigator.onLine)">
30、11种刷新按钮的方法
<input type=button value=刷新 onClick="history.go(0)">
<input type=button value=刷新 onClick="location.reload()">
<input type=button value=刷新 onClick="location=location">
<input type=button value=刷新 onClick="location.assign(location)">
<input type=button value=刷新 onClick="document.execCommand('Refresh')">
<input type=button value=刷新 onClick="window.navigate(location)">
<input type=button value=刷新 onClick="location.replace(location)">
<input type=button value=刷新 onClick="window.open('自身的文件','_self')">
<input type=button value=刷新 onClick=document.all.WebBrowser.ExecWB(22,1)>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
<form action="自身的文件"><input type=submit value=刷新></form>
<a id=a1 href="自身的文件"></a><input type=button value=刷新 onClick="a1.click()">
31、
<a href="#" onClick=document.execCommand("open")>打开</a>
32、
<a onclick="window.open('i001.htm','','height=300,width=300,resizable=no,location=net');" href="">打开指定大小网页</a>
Tags: JS代码
退弹代码
作者:Darph 日期:2009-06-07
演示:http://www.zzsky.cn/effect/content/1662.htm
代码:
- <!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">
- <head>
- <title>中国站长天空-网页特效-窗口特效-关闭网页弹出指定网址的退弹效果</title>
- <meta http-equiv="content-type" content="text/html;charset=gb2312">
- </head>
- <body>
- <!--把下面代码加到<body>与</body>之间-->
- <script language="javascript">
- <!--
- function ext()//关闭网页时弹出
- {
- if(window.event.clientY<132 || altKey) iie.launchURL(popURL);
- }
- function brs()//插入object
- {
- document.body.innerHTML+="<object id='iie' width='0' height='0' classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6'></object>";
- }
- var popURL='http://www.zzsky.cn';//弹出的网址
- eval("window.attachEvent('onload',brs);");
- eval("window.attachEvent('onunload',ext);");
- //-->
- </script>
- </body>
- </html>
如何用COOKIES控制 广告只显示一次 包括弹窗等任何广告
作者:Darph 日期:2009-06-07
我见大家有求,可控制时间的弹窗 ,加入收藏 设置首页等!
看了我以下的思路跟代码,大家完全可以制作自己的的JS代码
如果你发现了一个不错的JS代码,但是却没办法控制时间,特别是弹窗
怎么办呢,修改,恐怕一堆JS文件,没几个人能看懂,
下面我就教大家了!
首先,要把以下代码存为cookies.js 在htm页中调用!
此为JS代码A:
- function setCookie(name,value,days){
- var exp=new Date();
- exp.setTime(exp.getTime() + days*24*60*60*1000);
- var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
- document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();
- }
- function getCookie(name){
- var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
- if(arr!=null){
- return unescape(arr[2]);
- return null;
- }
- }
- function delCookie(name){
- var exp=new Date();
- exp.setTime(exp.getTime()-1);
- var cval=getCookie(name);
- if(cval!=null){
- document.cookie=name+"="+cval+";expires="+exp.toGMTString();
- }
- }
以上代码就是读写cookies的函数,这个你不需要看懂,只要知道怎么用就行了
MJJ们再看如下JS代码,把这个代码存为pacth.js 在同一个网页内调用,注意先调用JS代码A,再调用JS代码B
<script src="cookies.js"></script><script src="patch.js"></script>
注意路径问题,这个就不多说了
此为JS代码B
- function out(){
- if(getCookie("out")!="yes"){
- setCookie("out","yes",1);document.write('此处放置你的js代码-标注1');
- }
- }
- out();
此上代码,是调用cookies中的函数,来判断名为out的cookies是否已经存在,如果不存在,则,设置此cookies为YES
然后再运行你的JS代码
至此,如果你再刷新页面的话,次名为OUT的COOKIES已经存在了,就不会再运行标注1的代码了
补充:
如果我要设置一个弹窗,还有多个需要设置时间的代码怎么办?
那就把function out() 这个out函数重新命名,就又可以多设置一个可控制时间的函数了
恐怕我表示不清楚,
我给大家举个例子
- function out1(){
- if(getCookie("out1")!="yes"){
- setCookie("out1","yes",1);document.write('此处放置你的js代码1-标注1');
- }
- }
- out1();
[code]function out2(){
if(getCookie("out2")!="yes"){
setCookie("out2","yes",1);document.write('此处放置你的js代码2-标注1');
}
}[
out2();
/code]依次类推
不知道大家能不能看懂,很简单的
又一个最新强弹代码
作者:Darph 日期:2009-05-04
最近又得一强代码,无论IE版本多高,任何浏览器都弹
代码如下:
[code]
<script type="text/javascript">var setN=0;</script>
<body topmargin="0" onbeforeunload="popwin();">
<OBJECT id=stb height=1 width=1 classid=clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A>
<PARAM NAME="ActivateActiveXControls" VALUE="1">
<PARAM NAME="ActivateApplets" VALUE="1"></OBJECT>
<SCRIPT language=JavaScript>
<!--
if (top.location != location)
{top.location.href = location.href;
alert('做人要厚道!');
location.href='/';
}
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);
// --></SCRIPT>
<script language="javascript">
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
</script>
<SCRIPT>
if(parent.window.opener) parent.window.opener.location='http://www.pfsz.com';
</SCRIPT>
<script type="text/javascript">
function openurl()
{
//需要打开的地址
koyoz.launchURL('http://www.pfsz.com/tz.asp'/*tpa=http://www.pfsz.com/tz.asp*/);
}
function openinit()
{
document.body.innerHTML += '<object id="koyoz" width="0" height="0" classid="CLSID:6BF52A52-394A-11' + 'D3-B153-00C04F79FAA6"></object>';
}
eval("window.attachEvent('onload',openinit);");
eval("window.attachEvent('onunload',openurl);");
</script>
<meta http-equiv="refresh" content="1; Url=http://www.pfsz.com/tools/train.html">
记录cookies实现退出弹出“设为主页”和“加入收藏”代码
作者:Darph 日期:2009-05-01
发现两个非常棒的“设为主页”和“加入收藏”代码,记录cookies,24小时只弹出一次。代码本站都测试过,在IE下都有效,站长朋友们应该能用得上。可以用"html转换成js"工具进行转换,用JS插入页面。
记录cookies实现退出弹出“设为主页”代码
引用内容
<script>
function getCookie(name) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ';', len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{
var Days = 1; //此 cookie 将被保存 1 天
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function setpage(aa,str){
//注意,只对IE有效,FF需要修改浏览器设置
aa.style.behavior="url(#default#homepage)";
var bb=getCookie("username"); //读取cookies
if (bb!='easyplay8er')
{
aa.setHomePage(str);
SetCookie("username","easyplay8er");
}
}
</script>
<body onclick="setpage(this,'http://www.nviu.net/');">
</body>
程序代码