网页制作-常用JS代码汇集
网页设计代码大全

基本格式<html><head><title></title></head><body></body></html><!-- --> 添加注释<html>开始标记符,可以省略<head></head>首部标记<tItle></tItle> 标题标记符(唯一)<style type=contenttypemedIa=mediadesctItle=text ></style><scrIpt ></scrIpt>关于脚本的定义包含属性有type=contenttype 编程语言的内容类型language=cdata 编程语言名src=url 外部程序位臵charset=charset 外部程序的字符编码defer 设臵此布尔属性时,表示告知浏览器脚本并不产生任何文档内容(如,在javascript中没有"document.write"语句),从而使浏览器可以继续解释html 文件的内容并进行显示<noscrIpt></noscrIpt> 浏览器不支持客户端程序时显示里面的内容<basefont>基本字体的大小、颜色和"字体"(过时)包含属性有sIze=n 更改网页默认的字号属性,默认为3,n=1~7color=color 指定默认字体颜色face 指定默认字体id=id 唯一的id<base> 定义文档的默认url基准和默认目标框架(唯一)<a href="/project/data/"> 指定默认url 基准target="main" 指定默认的目标框架,单击连接时在默认框架显示<meta meta>标记符,包含了网页的元数据信息,如文档关键字、作者信息等包含属性有name=name 名字http-equIv=name http相应标题名content=cdata 相关数据<lInk>定义了文档的关联关系包含属性有rel=linktypes 到链接的关系rev=linktypes 来自链接的关系href=url 链接资源的urltype=contenttype 链接的内容类型target=frametarget 显示链接的目标框架medIa=mediadesc 链接的媒体hreflang=languagecode链接资源的语言charset=charset 链接资源的字符编码<body>正文标记符(开始标记符和结束标记符都可以省略)包含属性有bgcolor="#rrggbb" 背景颜色background="Image/image.gif" 背景图案teXt 设臵正文的颜色lInk 设臵未被访问的连接的颜色vlInk 设臵已被访问过的连接的颜色alInk 设臵活动连接(即当前选定的连接)的颜色onload=script 文档加载时执行脚本的事件onunload=script 文档退出时执行脚本的事件物理字符样式:<b></b> 粗体<bIg></bIg> 大字体<I></I> 斜体<s></s> 删除线<small></small> 小字体<strIke></strIke> 删除线<sub></sub> 下标<sup></sup> 上标<tt></tt> 固定宽度字体<u></u> 下划线<font></font> 标记符控制字符样式sIze=n 字号属性,用于控制文字大小,其值越大,显示的字体越大,n值=1~7,默认为3(使用<basefont sIze=n>可更改默认的字号属性),可用加减号来指定相对字号color="#rrggbb" 颜色属性:用于控制文字颜色,可使用颜色名称或十六进制指定颜色, 其中rr,gg,bb分别表示红,绿,蓝成分的两位十六进制值,ff表示包含满亮度的该种颜色;b0表示包含75%;80表示50%;40表示25%;00表示不含该颜色face="宋体,黑体,楷体" 字体样式:即"字体",浏览器优先使用第一种字体,若系统中没有则使用第二种,依次类推,如果找不到匹配字体,浏览器将使用默认字体逻辑字符样式<hn></hn> 标题样式:n=1~6,<h1></h1>表示最大的标题,<h6></h6>表示最小的标题,通常只使用前三级标题。
常用JS代码大全

常用JS代码大全事件源对象event.srcElement.tagNameevent.srcElement.type捕获释放event.srcElement.setCapture();event.srcElement.releaseCapture();事件按键event.keyCodeevent.shiftKeyevent.altKeyevent.ctrlKey事件返回值event.returnValue鼠标位置event.xevent.y窗体活动元素document.activeElement绑定事件document.captureEvents(Event.KEYDOWN);访问窗体元素document.all("txt").focus();document.all("txt").select();窗体命令document.execCommand窗体COOKIE document.cookie菜单事件document.oncontextmenu创建元素document.createElement("SPAN");根据鼠标获得元素:document.elementFromPoint(event.x,event.y).tagName=="TD document.elementFromPoint(event.x,event.y).appendChild(ms)窗体图片document.images[索引]窗体事件绑定document.onmousedown=scrollwindow;元素document.窗体.elements[索引]对象绑定事件document.all.xxx.detachEvent('onclick',a);插件数目navigator.plugins取变量类型typeof($js_libpath) == "undefined"下拉框下拉框.options[索引]下拉框.options.length查找对象document.getElementsByName("r1");document.getElementById(id);定时timer=setInterval('scrollwindow()',delay);clearInterval(timer);UNCODE编码escape() ,unescape父对象obj.parentElement(dhtml)obj.parentNode(dom)交换表的行TableID.moveRow(2,1)替换CSS document.all.csss.href = "a.css";并排显示display:inline隐藏焦点hidefocus=true根据宽度换行style="word-break:break-all"自动刷新<meta. HTTP-EQUIV="refresh" C>简单邮件<a href="[email=***********?subject=ccc&body=xxxyyy]mailto:***********?subject=ccc&bod y=xxxyyy[/email]">快速转到位置obj.scrollIntoView(true)锚<a name="first"><a href="#first">anchors</a>网页传递参数location.search();可编辑obj.contenteditable=true执行菜单命令obj.execCommand双字节字符/[^\x00-\xff]/汉字/[\u4e00-\u9fa5]/让英文字符串超出表格宽度自动换行word-wrap: break-word; word-break: break-all;透明背景<IFRAME. src="1.htm" width=300 height=180 allowtransparency></iframe>获得style内容obj.style.cssTextHTML标签document.documentElement.innerHTML第一个style标签document.styleSheets[0]style标签里的第一个样式document.styleSheets[0].rules[0]防止点击空链接时,页面往往重置到页首端。
常用js代码大全汇总

常用JS代码大全∙事件源对象event.srcElement.tagNameevent.srcElement.type∙捕获释放event.srcElement.setCapture();event.srcElement.releaseCapture();∙事件按键event.keyCodeevent.shiftKeyevent.altKeyevent.ctrlKey∙事件返回值event.returnValue∙鼠标位置event.xevent.y∙窗体活动元素document.activeElement∙绑定事件document.captureEvents(Event.KEYDOWN);∙访问窗体元素document.all("txt").focus();document.all("txt").select();∙窗体命令document.execCommand∙窗体COOKIEdocument.cookie∙菜单事件document.oncontextmenu∙创建元素document.createElement("SPAN");∙根据鼠标获得元素:document.elementFromPoint(event.x,event.y).tagName=="TD document.elementFromPoint(event.x,event.y).appendChild(ms) ∙窗体图片document.images[索引]∙窗体事件绑定document.onmousedown=scrollwindow;∙元素document.窗体.elements[索引]∙对象绑定事件document.all.xxx.detachEvent('onclick',a);∙插件数目navigator.plugins∙取变量类型typeof($js_libpath) == "undefined"∙下拉框下拉框.options[索引]下拉框.options.length∙查找对象document.getElementsByName("r1");document.getElementById(id);∙定时timer=setInterval('scrollwindow()',delay);clearInterval(timer);∙UNCODE编码escape() ,unescape∙父对象obj.parentElement(dhtml)obj.parentNode(dom)∙交换表的行TableID.moveRow(2,1)∙替换CSSdocument.all.csss.href = "a.css";∙并排显示display:inline∙隐藏焦点hidefocus=true∙根据宽度换行style="word-break:break-all"∙自动刷新<meta. HTTP-EQUIV="refresh" C>∙简单邮件<a href="[email=aaa@?subject=ccc&body=xxxyyy]mailto:aaa@bb?subject=ccc&body=xxxyyy[/email]">∙快速转到位置obj.scrollIntoView(true)∙锚<a name="first"><a href="#first">anchors</a>∙网页传递参数location.search();∙可编辑obj.contenteditable=true∙执行菜单命令obj.execCommand∙双字节字符/[^\x00-\xff]/汉字/[\u4e00-\u9fa5]/∙让英文字符串超出表格宽度自动换行word-wrap: break-word; word-break: break-all;∙透明背景<IFRAME. src="1.htm" width=300 height=180 allowtransparency></iframe>∙获得style内容obj.style.cssText∙HTML标签document.documentElement.innerHTML∙第一个style标签document.styleSheets[0]∙style标签里的第一个样式document.styleSheets[0].rules[0]∙防止点击空链接时,页面往往重置到页首端。
网页设计代码大全

<body></body> 段落标记background:网页背景图像<p>…</p> bgcolor:网页背景颜色align:left right center text:字体颜色强制换行标记link:可链接文字的色彩<br></br> alink:被鼠标点中时可链接文字的颜色预排格式标记vlink:已经单击过的可链接文字的颜色<pre></pre> leftmargin:页面左边距插入水平线标记topmargin:页面上边距<hr width=“宽度” size=“厚度”标题格式标记align=“对齐方式” color=“颜色”Alink:被鼠标点中时可链接文字的颜色noshacle:除阴影 > Vlink:已经单击过的可链接文字的颜色文本缩标记Leftmargin:页面左边距<blockquote>…</blockquote> Topmargin:页面上边距列表标记标题格式标记 1.无序<hn>标题</hn> (范围(h1-h6))<ul type= “加重符号类型”> align:left(左) right(右) center(中) <li type=“加重符号类型”>列1 bottom(底) top(顶) <li type=“加重符号类型”>列2 文字格式标记………<font face=“字体” size=“字号”</ul> color=“颜色”>文字</font> type:disc● circle○ square■字形设置标记 2.有序<b>字形</b> 粗 <u>字形</u> 下划线<ol type=“序号类型” stare=“起始号码”> <i>字形</i> 斜 <big>字形</big>文字增大<li type=“加重符号类型”>列1 <strike>字形</strike> 删除线<li type=“加重符号类型”>列2<small>字形</small> 文字减小………<sup>字形</sup> 上标 <sub>字形<sub>下标</ol> <tt>字形</tt> 宽体 <em>字形</em> 强调 3.定义<bink>字形<bink> 闪烁 <cite>字形<cite>斜<dl> <dt>条目1<dd>条目1的说明<strong>字形</strong> 特别强调………</dl> 文字滚动标记<img>的图像标记<marquee>文字滚动</marquee> <img> behavior(滚动方式):alternate(交替) sic:图片的路径 scroll(往复) slide(一次) longdesc:详细说明bgcolor:背景颜色alt:替代说明direction(滚动方向):up(上) down(下) width和height:图片的宽和高 left(左) right(右) border:图片外围边框的宽度height和width:滚动的区域hspace和vspace:水平和垂直方向空白loop:循环的次数值是-1 align:left right center scrollamount:滚动的速度加快<img>的视频标记scrolldelay:滚动的速度延迟src:静态图像的路径hspace和vspace:滚动的水平垂直空间dynsrc:视频的路径表格标记loop:infinite或-1(反复播放) <table> start(设置何时播放视频文件):fileopen和mouseover <caption>表格标题</caption>→align controls:加播放控制条<tr>→align和valign loopdelay:两次播放的间隔<th>表头1</th> <th>表头2</th>…背景音乐标记</tr> <bgsound> <tr> src:音乐地址 loop:次数(-1) <td>(width和nowrap)表项1</td>…多媒体标记<embed></embed></tr> src:多媒体的地址………height和width:播放的区域<table> hidden:播放面板的显示和隐藏值true和false summary:简要说明 bgcolor:表格的背景颜色autostart:是否自动播放(true和false) background:表格的背景图像 border:表格线的粗细loop:是否循环(true和false) width和height表格的宽和高 align:左、右、中超链接标记valign:顶、(middle)中、底 bordercolor:表格线的颜色<a>…</a> nowrap:禁止表格单元格内的内容自动换行href:链接到的目标的地址rowspan=n n=1 为一行单元格target:链接的目标窗口colspan=n n=1 为一列的合并self(原) blank(新) parent(上) top(整)表单标记1.表单标记<form><form name= “form_name” method=“method” action=“url” enctype=“value” target=“target_win”>……</form>name:设置表单的名称 method=处理程序从表单中获得信息的方式其取值为get和post action:定义表单处理程序(asp、cgi等程序)的位置(相对位置或绝对位置)enctype:设置表单资料的编码方式 target:设置返回信息的显示窗口2.输入标记<input><input name=“field_name” type=“type_name”>name:设置输入区域的名称type:设置输入区域的类型(有10种)①文本域text(maxlength:文本域的最大输入字符 size:文本域的宽度 value:初始默认值)②密码域password(maxlength:密码域的最大输入字符 size:密码域的宽度)③文件域file(input type=“file”)④复选框checkbox((checked)表示此项被默认选中value:选中项目后传送到服务器端的值)⑤单选框radio(同4)⑥普通按钮button(value值代表显示在按钮上的文字)⑦“提交”按钮submit(value=“button_text”)⑧“重设”按钮reset(value=“button_text”)⑨图像域image(src:设置图片的路径)⑩隐藏域hidden(input type=“hidden”)3.菜单和列表的标记<select>和<option><select name=“name” size=“value” multiple><option value=“value” selected>选项一<option value=“value”>选项二………</select>size:显示的选项数目(multiple:不用赋值就可以直接加入到标记中,就成多选了)<optiop>→value:用来给<optiop>指定的选项赋值这个值是要传送到服务器上的(selected):指定初始默认的选项4.文本框标记<textarea><textarea></textarea>name:名称 rows:设置文本框的行数 cols:文本框的列数框架标记1.框架集标记<frameset><framese cols=“value,value,…” rows=“value,value,…” framespacing=“value”bordercolor=“color_value”>……</frameset>cols:左右分割窗口(用“,”分割) rows:上下分割(用“,”分割)framespacing:框架集的边框宽度bordercolor:框架集的边框颜色2.框架标记<frame src=“file_name” name=“frame_name” scrolling=“value” noresize>…</frame>src:框架显示的文件路径 name:框架的名称(用来供超文本链接标记)scrolling:滚动条是否显示值(yes , no , auto)3.不支持框架标记<noframes>………</noframes>css1.css称为“层叠样式表”或“级联样式表”2.css的基本语法:html标记{标记属性:属性值;标记属性:属性值;…}列如:b,i,h1{color:red}3.css的实现方法(有三种)①在head内实现(叫内部样式表他写在html的<head></head>里面的)内部样式表要用style标记(<style type=“text/css”> h1{color:red}</style>)②在body内实现(叫内嵌样式他在body中实现,主要是在标记中引用,只对所在的标记中有效)③在文件外实现(叫外部样式表)<link href=“style.css” rel=“stylesheet”>4.三种css实现方法的比较样式的优先级依次是内嵌样式,内部样式表,外部样式表使用外部样式时相对于前两种有以下优点:②样式代码可以复用,一个外部css文件,可以被多个网页共用②便于修改,只需修改css文件,不用修改每个网页③提高了网页的显示速度Welc ome To Dow nloa d !!!欢迎您的下载,资料仅供参考!。
网页编写代码大全总结

[网页设计] 网页基本标签代码大全1.公司版权注释<!— The site is designed by Maketown,Inc 06/2000 —>2.网页显示字符集简体中文:<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html;charset=gb2312″>繁体中文:<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=BIG5″>英语:<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html;charset=iso-8859-1″>3.网页制作者信息<METAname=”author”content=”**********************”>4.网站简介<META NAME=”DESCRIPTION” CONTENT=”xxxxxxxxxxxxxxxxxxxxxxxxxx”>5.搜索关键字<META NAME=”keywords” CONTENT=”xxxx,xxxx,xxx,xxxxx,xxxx,”>6.网页的css规范<LINK href=”style/style.css” rel=”stylesheet” type=”text/css”>(参见目录及命名规范)7.网页标题<title>xxxxxxxxxxxxxxxxxx</title>.可以选择加入的标签1.设定网页的到期时间。
一旦网页过期,必须到服务器上重新调阅。
<META HTTP-EQUIV=”expires” CONTENT=”Wed, 26 Feb 1997 08:21:57 GMT”>2.禁止浏览器从本地机的缓存中调阅页面内容。
制作网页过程中经常要用到的js代码教程

ss="Left=" + x + ",Top=" + y + ",Height=100,width=100,toolbar=no,scrollbars=yes";
window.open(url,"",ss);
}
</script>
*如果是打开两个不互相替换的窗口则添加一个不同名字的function即可,例如:
如是点击Flash按钮,则在显示页的HEAD中写
<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
6. 如何让背景图象不滚动
◆代码:<BODY Background="bg.gif" Bgproperties="fixed" >
◆在Dreamweaver中用「Text」-「Custom style」-「Edit style Sheet」-「New」-Redefine HTML Tag中选择Body,然后在Background中的Attachment里选fixed
10. 如何设置命令来关闭打开的窗口
◆在源代码中加入如下代码:
< a href="/" onclick="javascript:window.close(); return false;">关闭窗口< /a>
个人网页设计常用代码集合

个人网页设计常用代码集合时间: 2006-01-10 02:42:09 | [<<][>>]1、禁止页面正文容被选取<body oncontextmenu="return false" ondragstart="return false"onselectstart ="return false" onselect="document.selection.empty()"oncopy="document.selection.empty()" onbeforecopy="returnfalse"onmouseup="document.selection.empty()">2、消除ie6自动出现的图像工具栏,设置 GALLERYIMG属性为false或no .<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px"GALLERYIMG="no">3、防止点击空时,页面往往重置到页首端。
代码"javascript :void(null)"代替原来的"#"标记4、如何避免别人把你的网页放在框架中<script language="javascript"><!--if (self!=top) --></script>5、页面定时刷新<meta http-equiv="Refresh" content="秒" >6、页面定时转向新的地址<meta http-equiv="refresh" content="秒;URL=url">7、关闭窗口,这个是不会弹出提示直接关的:把如下代码加入<body>区域中<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><param name="Command" value="Close"></object><script language="javascript">function shutwin()</script><a href="javascript :shutwin();">关闭本窗口</a>网页设计常用代码(二)有时候好不容易写出来的程序代码被别人抄去,心里一定不好受。
javascript常用代码大全-网页设计HTMLCSS

javasc ript常用代码大全-网页设计,HTM LCSS//打开模式对话框fun ction dose lectu ser(t xtid){ s trfea tures="dia logwi dth=500px;dialo gheig ht=360px;c enter=yes;middl e=yes ;hel p=n o;statu s=no;scrol l=no";v ar ur l,str retur n; ur l="se luser.aspx";s trret urn=w indow.show modal dialo g(url,,str featu res);}//返回模式对话框的值funct ion o kbtn_oncli ck(){v ar co mmstr=; windo w.ret urnva lue=c ommst r; wi ndow.close() ;}全屏幕打开ie 窗口var winw idth=scree n.ava ilwid th ;varwinhe ight=scree n.ava ilhei ght-20;w indow.open("mai n.asp x","s urvey windo w","t oolba r=no,width="+ w inwid th +",hei ght=" + win heigh t +",top=0,lef t=0,s croll bars=yes,r esiza ble=y es,ce nter:yes,s tatus bars=yes"); br eak //脚本中中使用xm lfu nctio n ini tiali ze(){var x mldocv ar xs ldoc xmld oc =new a ctive xobje ct(mi croso ft.xm ldom)x mldoc.asyn c = f alse;xsl doc = newactiv exobj ect(m icros oft.x mldom)xsldo c.asy nc =false;xml doc.l oad("tree.xml")x sldoc.load("tre e.xsl")fol dertr ee.in nerht ml =xmldo c.doc ument eleme nt.tr ansfo rmnod e(xsl doc)}一、验证类1、数字验证内1.1 整数1.2 大于0的整数(用于传来的id的验证) 1.3负整数的验证 1.4整数不能大于imax1.5 整数不能小于i min 2、时间类2.1 短时间,形如(13:04:06)2.2 短日期,形如(2003-12-05) 2.3长时间,形如 (2003-12-05 13:04:06) 2.4只有年和月。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
把如下代码加入<body>区域中:后退前进<input type="button"value="后退"onClick="history.go(-1)"><input type="button"value="前进"onClick="history.go( 1 );return true;">返回<form><input type="button"value="返回上一步"onClick="history.back(-1)"></form>查看源码<input type="button"name="view"value="查看源码"onClick="window.location="view-source:" +window.location.href">禁止查看源码<body oncontextmenu="return false"></body>刷新按钮一<input type="button"value="刷新按钮一"onClick="ReloadButton()"><script>function ReloadButton(){location.href="i001.htm";}i</script>刷新按钮二<input type="button"value="刷新按钮二"onClick="history.go(0)">回首页按钮<input type="button"value="首页"onClick="HomeButton()"><script>functionHomeButton(){location.href=;}</script>弹出警告框<input type="button"value="弹出警告框"onClick="AlertButton()"><script>function AlertButton(){window.alert("要多多光临呀!");}</script>状态栏信息<input type="button"value="状态栏信息"onClick="StatusButton()"><script>function StatusButton(){window.status="要多多光临呀!";}</script>背景色变换<form><input type="button"value="背景色变换"onClick="BgButton()"></form> <script>function BgButton(){if(document.bgColor==’#00ffff’){document.bgColor=’#ffffff’;}else{document.bgColor=’#00ffff’;}}</script>打开新窗口<input type="button"value="打开新窗口"onClick="NewWindow()"><script>functionNewWindow(){window.open("c01.htm","","height=240,width=340,status=no,lo cation=no,toolbar=no,directories=no,menubar=no");}</script>窗口最小化<OBJECT id="min"type="application/x-oleobject"classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11″><PARAM name="Command"value="Minimize"></OBJEC T><button onClick="min.Click()">窗口最小化</button>全屏代码<input type="BUTTON"name="FullScreen"value="全屏显示"onClick="window.open(document.location, ‘butong_net’, ‘fullscreen’)">关闭窗口<OBJECT id=closes type="application/x-oleobject"classid="clsid:adb880a6-d 8ff-11cf-9377-00aa003b7a11″><param name="Command"value="Close"></object> <input type="button"value="关闭窗口"onClick="closes.Click();">关闭窗口<input type=button value=关闭窗口onClick="javascript:self.close()">最大化<object id=big classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11″><param name="Command"value="Maximize"></object><input type=button value=最大化onClick=big.Click()>关闭输入法<input style="ime-mode:disabled"value=关闭输入法>链接按钮1<input type="button"value="链接按钮1″onClick="window.open(’/’, ‘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′)"na me="input">链接按钮2<input type="BUTTON"NAME="Button"value="链接按钮2″onClick="showModalDialog(’/’)">链接按钮3<input type="submit"value="链接按钮3″onClick="location.href=’/’">警告框显示源代码<BUTTON onClick=alert(document.documentElement.outerHTML)style="width:110″>警告框显示源代码</BUTTON>点击后按钮清空<input type=button value=’打印’onClick="this.style.visibility=’hidden’;window.print();">打印<input type=button value=’打印’onClick="window.print();">打印预览<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2″height=0id=w b name=wb width=0></OBJECT><input type=button value=打印预览onclick="wb.execwb(7,1)">另存为<input onClick="document.execCommand(’saveas’,'true’,'常用代码.htm’)"type=button value=另存为>点击自动复制<script>functionoCopy(obj){obj.select();js=obj.createTextRange();js.execCommand("Copy") }</script><input type="text"value="点击自动复制"onClick="oCopy(this)"size="11″>自动选中<input value="自动选中"onFocus="this.select()"onMouseOver="this.focus()"size="11″>打开源代码<BUTTON onClick="document.location = ‘view-source:’ +document.location"size="7″>打开源代码</BUTTON>新窗口延迟打开<input type=button value=新窗口延迟打开onClick=javascript:setTimeout("window.open(’/’)" ,10000)>实现选中文本框里的前一半的内容<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.selec tionEnd=this.value.length">点击清空文字<input type="text"name="artist"size=14value="点击清空文字"onmouseover=this.focus() onfocus=this.select()onclick="if(this.value==’点击清空文字’)this.value="">点击清空文字<input name=name size=11value=点击清空文字onMouseOver=this.focus()onblur="if (this.value ==")this.value=’点击清空文字’"onFocus=this.select()onClick="if (this.value==’点击清空文字’)this.value="">等于标题(title):<input type="text"value=""id="aa"size="20″><script>document.getElementById("aa").value=document.title;</script>检测IE是否脱机<input type="button"value="测试"onclick="alert(window.navigator.onLine)">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-00C04FD705A2height=0id=Web Browser width=0></OBJECT><form action="自身的文件"><input type=submit value=刷新></form><a id=a1href="自身的文件"></a><input type=button value=刷新onClick="a1.click()"><a href="#"onClick=document.execCommand("open")>打开</a><a onclick="window.open(’i001.htm’,",’height=300,width=300,resizable=no, location=net’);"href="">打开指定大小网页</a><a href="#"onClick=location.replace("view-source:"+location)>使用记事本编辑</a><a href="#"onClick=document.execCommand("saveAs")>另存为</a><a href="#"onClick=document.execCommand("print")>打印</a><a href="javascript:window.print();">打印</a><a href=mailto:429752806@>发送E-mail</a><a href="#"onClick=document.execCommand("selectAll")>全选</a><a href="#"onClick=location.reload()>刷新1</a><a href="#"onClick=history.go(0)>刷新2</a><a href="#"onClick=location.replace("view-source:"+location)>查看源文件</a><a href="#"onClick=window.open(document.location,"url","fullscreen")>全屏显示</a><a href="#"onClick=window.external.showBrowserUI("PrivacySettings",null) >internet选项</a><a href="#"oncontextmenu="window.open(this.href);return false;">单击右键将在新窗口中打开</a><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><a href="#"onClick=window.external.showBrowserUI("OrganizeFavorites",nul l)>整理收藏夹</a><SPAN onClick="window.external.addFavorite(’/’,'网页特效站点’)"style="CURSOR: hand"title=网页特效站点>加入收藏</SPAN><a href="#"onClick="window.external.addFavorite(’ /’,'网页特效站点’)">添加到收藏夹</A><a href="javascript:window.external.AddFavorite(’ /’, ‘网页特效站点’)">点击加入收藏夹</a><a href="#"onmouseover="window.external.addFavorite(’http://www.winliuxq .com/’,'网页特效站点’)"target="_self">鼠标感应收藏本站</a><a href="#"onmouseover="this.style.behavior=’url(#default#homepage)’;thi s.setHomePage(’/js/’);"target="_self">鼠标感应设为首页</a><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><SPAN onClick="varstrHref=window.location.href;this.style.behavior=’url(#default#homepage )’;this.setHomePage(’/’);"style="CURSOR: hand">设为首页</SPAN>等于标题栏:<script>document.write(document.title);</script><a href="javascript:void(0);"onClick=’window.external.AddFavorite(locati on.href,document.title);’>收藏本页</a><a href="javascript:window.external.AddFavorite(document.location.href, document.title)">收藏本页</a><a href=javascript:window.external.addChannel("typhoon.cdf")>加入频道</a><a href="i003.htm"onclick="returnfalse;"ondblclick="window.open(’i003.htm’);">双击打开链接</a><style>#close a:hover{background:url(javascript:window.opener=0;window.close());}</style><div id=close><a href="">关闭窗口</a></div><A HREF="javascript:void(0)"onMouseover="alert(’对不起,禁止选中!’)">链接禁止</A><a href=""onMouseOver="alert(’本站域名:/’);return true;">记住本站域名</a>滚动条在左侧,将<html>改为<HTML DIR="RTL">网页半透明<body style="filter:Alpha(Opacity=50)">随机选择背景色<body><script>document.body.style.background=(["red","blue","pink","navy","gray","yel low","green","purple"])[parseInt(Math.random()*8)];</script>框架页中不显示滚动条:<SCRIPT>self.moveTo(0,0)self.resizeTo(screen.availWidth,screen.availHeight)</SCRIPT>防止网页被框架<SCRIPT LANGUAGE=JAVASCRIPT>if (top.location !== self.location) {top.location=self.location;}</SCRIPT>永远都会带着框架<script language="javascript"><!–if(window == top)top.location.href = “frame.htm"; //frame.htm为框架网页// –></script>窗口自动最大化<script language="JavaScript"><!–self.moveTo(0,0)self.resizeTo(screen.availWidth,screen.availHeight)//–></script>打开窗口自动最大化<OBJECT classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11″ onreadystatechange="if(this.readyState==4)this.Click();"VIEWASTEXT><PARAM name="Command"value="Maximize"></OBJECT>爽眼闪屏代码<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>不能被另存为<noscript><iframe src=*.html></iframe></noscript>汉字字库调用<script>for(i=19968;i<40870;i++)document.write(String.fromCharCode(i));</script>显示现在时间的脚本<script language=vbscripti>document.write now</script>显示最后修改时间的脚本<script>document.write(stModified)</script>按下F12键,直接返回首页<script>function look(){if(event.keyCode==123){document.location.href=/} }if(document.onkeydown==null){document.onkeydown=look}</script>端口检测<img src="http://www.winliuxq/zza.jpg"onload="alert(’端口可用’)"onerror="alert(’端口禁止’)"…>无法最小化的窗口<body onblur=’self.focus();’>链接点外部css文件<style>@import url("ie.css");</style>内嵌式框架-网页中调用另外网页:<object type="text/x-scriptlet"width="600″ heigh t="1000″data="/"></object>刷新改变窗口大小<OBJECT classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11″ onreadystatechange="if(this.readyState==4)this.Click();"VIEWASTEXT><PARAM name="Command"value="Maximize"></OBJECT>JavaScript实现网页竖虚线<script>heii=120;d1=2;d2=2;cou=Math.floor(hei/(d1+d2));document.write(’<table cellspacing=0 cellpadding=0 width=1height=’+hei+’>’);for(i=0;i<cou;i++){document.write(’<tr><td height=’+d2+’><tr><tdheight=’+d1+’ bgcolor=333333>’)}</script></table>js翻页<script>document.write("<ahref="+location.href.replace(/\.html/g,"_2.html")+">2</a>");</script>内容转载于:/henter1987/blog/item/83bc0e08ce1e0839e92488a7.html。