版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、你的选择是做或不做,但不做就永远不会有机会。Html网页设计代码 设计第一技术其次 : )-1)贴图:<img src="图片地址">2)加入连接:<a href="所要连接的相关地址">写上你想写的字</a>1)贴图:<img src="图片地址">2)加入连接:<a href="所要连接的相关地址">写上你想写的字</a>3)在新窗口打开连接:<a hre
2、f="相关地址" target="_blank">写上要写的字</a>消除连接的下划线在新窗口打开连接:<a href="相关地址" style="text-decoration:none" target="_blank">写上你想写的字</a>4)移动字体(走马灯):<marquee>写上你想写的字</marquee>5)字体加粗:<b>写上你想写的字</b>6)字体斜体:<i>写上你想写的字
3、</i>7)字体下划线: <u>写上你想写的字</u>8)字体删除线: <s>写上你想写的字</s>9)字体加大: <big>写上你想写的字</big>10)字体控制大小:<h1>写上你想写的字</h1> (其中字体大小可从h1-h5,h1最大,h5最小)11)更改字体颜色:<font color="#value">写上你想写的字</font>(其中value值在000000与ffffff(16位进制)之间12)消除连接的下划线:<a h
4、ref="相关地址" style="text-decoration:none">写上你想写的字</a>13)贴音乐:<embed src=音乐地址 width=300 height=45 type=audio/mpeg autostart="false">14)贴flash: <embed src="flash地址" width="宽度" height="高度">15)贴影视文件:<img dynsrc="文件地址&q
5、uot; width="宽度" height="高度" start=mouseover>16)换行:<br>17)段落:<p>段落</p>18)原始文字样式:<pre>正文</pre>19)换帖子背景:<body background="背景图片地址">20)固定帖子背景不随滚动条滚动:<body background="背景图片地址" bodybgproperties=fixed>21)定制帖子背景颜色:<body b
6、gcolor="#value">(value值见10)22)帖子背景音乐:<bgsound="背景音乐地址" loop=infinite>23)贴网页:<iframe src="相关地址" width="宽度" height="高度"></iframe>/-HTML特效代码-/1。忽视右键 <body oncontextmenu="return false"> 或 <body style="overflow
7、-y:hidden"> 2。加入背景音乐 IE:<bgsound src="*.mid" loop=infinite> NS:<embed src="*.mid" autostart=true hidden=true loop=true> </embed> *.mid你的背景音乐的midi格式文件 3。简单的window.open方法 <a href="#" onclick="javascript :window.open(文件路径/文件名,newwindow, to
8、olbar=no,scrollbars=yes,resizable=no,top=0,left=0, width=400,height=300);">文字或图片</a> 参数解释: <SCRIPT LANGUAGE="javascript"> js脚本开始; window.open 弹出新窗口的命令; 文件路径/文件名 弹出窗口的文件名; newwindow 弹出窗口的名字(不是文件名),非必须,可用空代替; width=400 窗口宽度; height=300 窗口高度; top=0 窗口距离屏幕上方的象素值; left=0 窗口距
9、离屏幕左侧的象素值; toolbar=no 是否显示工具栏,yes为显示; menubar,scrollbars 表示菜单栏和滚动栏。 resizable=no 是否允许改变窗口大小,yes为允许; location=no 是否显示地址栏,yes为允许; status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许; </SCRIPT> js脚本结束 4。简单的页面加密 <script LANGUAGE="javascript"> <!- function loopy() var sWord ="" whi
10、le(sWord!="login")sWord=prompt("请输入你的登陆密码"); alert("登陆成功!"); loopy() /-> </script> 5。拉动页面时背景图不动 <style> bodybackground-image:url(logo.gif); background-repeat:no-repeat;background-position:center </style> 6。让浏览器在保存页面时保存失败 <NOSCRIPT><iframe s
11、rc="*.html"></iframe></NOSCRIPT> 7。随机替换图片 <script> document.write(<img src="img/+parseInt(Math.random()*(5) +.gif"height="40" width="50"> </script> 图片文件名为0.gif 1.gif 2.gif 3.gif 4.gif 8。窗口定时关闭 先将如下代码网页文件的区: <script language=
12、"javascript"> function closeit() setTimeout("self.close()",10000) /毫秒 </script> 然后再在<body>标内加入如:<body onload="closeit()"> 9。网页自动关闭 <html> <head> <object id=closes type="application/x-oleobject" classid="clsid:adb880a6-d
13、8ff-11cf-9377-00aa003b7a11"> <param name="Command" value="Close"> </object> </head> <body onload="window.setTimeout(closes.Click(),10000)"> 这个窗口会在10秒过后自动关闭,而且不会出现提示. </body> </html> 10。网页自动刷新 在head部记入 <META HTTP-EQUIV="
14、;Refresh" content="20"> 其中20为20秒后自动刷新,你可以更改为任意值。 11。网页自动转页 <META HTTP-EQUIV="Refresh" CONTENT="时间(秒);URL=地址"> 12。保持layer在最前面,而不被Iframe、Object所覆盖 在Layer中再插Iframe 或 Object 设z-Index值 <div z-Index:2><object xxx></object> 前面 <div z-Index:1&
15、gt;<object xxx></object> 后面 <div id="Layer2" style="position:absolute; top:40;width:400px; height:95px;z-index:2"> height=100% width=100%> <iframe width=0 height=0></iframe> </div> <div id="Layer1" style="position:absolute;
16、 top:50;width:200px; height:115px;z-index:1"> <iframe height=100% width=100%></iframe> </div> 13。返回上一页 <a href=javascript :history.back(1)>返回上一页</a> 14。关闭窗口 <a href=javascript :self.close()>关闭窗口</a> 15。关于iframe的透明背景 <IFRAME ID="iFrame1"
17、SRC="iframe.htm" allowTransparency="true" style="background-color: green"></IFRAME> 16. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键 <table border oncontextmenu=return(false)><td>no</table> 可用于Table 17. <body onselects
18、tart="return false"> 取消选取、防止复制 18.onpaste="return false" 不准粘贴 19.oncopy="return false;" oncut="return false;" 防止复制20. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标21. <link rel="Bookmark" href="favic
19、on.ico"> 可以在收藏夹中显示出你的图标22. <input style="ime-mode:disabled"> 关闭输入法23. 永远都会带着框架 <script language="JavaScript"><!- if (window = top)top.location.href = "frames.htm" /frames.htm为框架网页 / -></script>24. 防止被人frame<SCRIPT LANGUAGE=JAVASCRIPT&g
20、t;<!- if (top.location != self.location)top.location=self.location; / -></SCRIPT>25. 网页将不能被另存为<noscript><iframe src=*.html></iframe></noscript>26. 查看网页源代码<input type=button value=查看网页源代码 onclick="window.location = "view-source:"+ ""&quo
21、t;>27.删除时确认<a href="javascript :if(confirm("确实要删除吗?")location="boos.asp? &areyou=删除&page=1"">删除</a>28.屏蔽功能键Shift,Alt,Ctrl <script> function look() if(event.shiftKey) alert("禁止按Shift键!"); /可以换成ALTCTRL document.onkeydown=look; </s
22、cript>29. 网页不会被缓存 <META HTTP-EQUIV="pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 或者<META HTTP-E
23、QUIV="expires" CONTENT="0">30.怎样让表单没有凹凸感? <input type=text style="border:1 solid #000000"> 或 <input type=text style="border-left:none; border-right:none; border -top:none; border-bottom: 1 solid #000000"></textarea>31.不要滚动条? 让竖条没有: <bod
24、y style="overflow:scroll;overflow-y:hidden"> </body> 让横条没有: <body style="overflow:scroll;overflow-x:hidden"> </body> 两个都去掉?更简单了 <body scroll="no"> </body>32.怎样去掉图片链接点击后,图片周围的虚线?<a href="#" onFocus="this.blur()">
25、<img src="logo.jpg" border=0></a>33.电子邮件处理提交表单<form name="form1" method="post" action="mailt*.com" enctype="text/plain"> <input type=submit> </form>34.在打开的子窗口刷新父窗口的代码里如何写? window.opener.location.reload()35.如何设定打开页面的大小 &l
26、t;body onload="top.resizeTo(300,200);"> 打开页面的位置<body onload="top.moveBy(300,200);">36.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动 <STYLE> body background-image:url(logo.gif); background-repeat:no-repeat; background-position:center;background-attachment: fixed </STYLE>37. 检查
27、一段字符串是否全由数字组成 <script language="Javascript"><!- function checkNum(str)return str.match(/D/)=null alert(checkNum("1232142141") alert(checkNum("123214214a1") / -></script>38. 获得一个窗口的大小 document.body.clientWidth; document.body.clientHeight39. 怎么判断是否是字符 if
28、 (/x00-/xff/g.test(s) alert("含有汉字"); else alert("全是字符");40.TEXTAREA自适应文字行数的多少 <textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight"> </textarea>41. 日期减去天数等于第二个日期 <script language=Javascript> function cc(dd,dadd) /可以
29、加上错误处理 var a = new Date(dd) a = a.valueOf() a = a - dadd * 24 * 60 * 60 * 1000 a = new Date(a) alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日") cc("12/23/2002",2) </script>42. 选择了哪一个Radio <HTML><script language="v
30、bscript"> function checkme() for each ob in radio1 if ob.checked then window.alert ob.value next end function </script><BODY> <INPUT name="radio1" type="radio" value="style" checked>Style <INPUT name="radio1" type="radio"
31、 value="barcode">Barcode <INPUT type="button" value="check" onclick="checkme()"> </BODY></HTML>43.脚本永不出错 <SCRIPT LANGUAGE="JavaScript"> <!- Hide function killErrors()return true; window.onerror = killErrors; / -> <
32、/SCRIPT>44.ENTER键可以让光标移到下一个输入框 <input onkeydown="if(event.keyCode=13)event.keyCode=9">45. 检测某个网站的链接速度: 把如下代码加入<body>区域中: <script language=Javascript> tim=1 setInterval("tim+",100) b=1 var autourl=new Array() autourl1="" autourl2="" autourl
33、3="" autourl4="" autourl5="" function butt() document.write("<form name=autof>") for(var i=1;i<autourl.length;i+) document.write("<input type=text name=txt"+i+" size=10 value=测试中> =<input type=text name=url"+i+" size=
34、40> =<input type=button value=GOonclick=window.open(this.form.url"+i+".value)><br>") document.write("<input type=submit value=刷新></form>") butt() function auto(url) document.forms0"url"+b.value=url if(tim>200) document.forms0"txt&
35、quot;+b.value="链接超时" else document.forms0"txt"+b.value="时间"+tim/10+"秒" b+ function run()for(var i=1;i<autourl.length;i+)document.write("<img src=http:/"+autourl+"/"+Math.random()+" width=1 height=1 nerror=auto("http:/"+
36、autourl+"")>") run()</script>46. 各种样式的光标 auto :标准光标 default :标准箭头 hand :手形光标 wait :等待光标 text :I形光标 vertical-text :水平I形光标 no-drop :不可拖动光标 not-allowed :无效光标 help :?帮助光标 all-scroll :三角方向标 move :移动标 crosshair :十字标 e-resize n-resize nw-resize w-resize s-resize se-resize sw-resize4
37、7、禁止鼠标右键,把Demo的图片全都设为表格的背景,表格的大小与图片的大小一样。这样做看起来是一样的,主要是防止鼠标经过图片时会出现另存的按钮。禁止鼠标右键的代码很简单:<script LANGUAGE="JavaScript"> function click() if (event.button=2) alert(呵呵,不好意思,你甭想使用右键下载图片:)); document.onmousedown=click</script>48、在网页的Head部分加入如下代码,这段代码的主要功能是屏蔽PrintScreen键,不断清空剪贴版,防止图片被用
38、文件另存为菜单另存。<script language="javascript"><!-function testclip()try if(clipboardData.getData("Text")|clipboardData.getData("HTML")|clipboardData.getData("URL") null;catch(e)clipboardData.setData("Text","")setTimeout("testclip()&
39、quot;,500)testclip();/-></script>/1. 将彻底屏蔽鼠标右键<table border oncontextmenu=return(false)><td>no</table> 可用于Table2. <body> 取消选取、防止复制3. 不准粘贴4. 防止复制5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标6. <link rel="Bookmark"
40、; href="favicon.ico"> 可以在收藏夹中显示出你的图标7. <input style="ime-mode:-Disabled"> 关闭输入法8. 永远都会带着框架<script language="javascript"><!-if (window = top)top.location.href = "frames.htm" /frames.htm为框架网页/ -></script>9. 防止被人frame<SCRIPT LANGUAGE
41、=javascript><!- if (top.location != self.location)top.location=self.location;/ -></SCRIPT>10. 网页将不能被另存为<noscript><iframe src=*.html></iframe></noscript> 11. <input type=button value=查看网页源代码 onclick="window.location = view-source:+ 12.删除时确认<a href=jav
42、ascript:if(confirm("确实要删除吗?"location="boos.asp?&areyou=删除&page=1">删除</a> 13. 取得控件的绝对位置/javascript<script language="javascript">function getIE(E)var t=e.offsetTop;var l=e.offsetLeft;while(e=e.offsetParent)t+=e.offsetTop;l+=e.offsetLeft;alert("
43、top="+t+"/nleft="+l);</script>/VBScript<script language="VBScript"><!-function getIE()dim t,l,a,bset a=document.all.img1t=document.all.img1.offsetTopl=document.all.img1.offsetLeftwhile a.tagName<>"BODY"set a = a.offsetParentt=t+a.offsetTopl=l+a
44、.offsetLeftwendmsgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"end function-></script>14. 光标是停在文本框文字的最后<script language="javascript">function cc()var e = event.srcElement;var r =e.createTextRange();r.moveStart(character,e.value.len
45、gth);r.collapse(true);r.select();</script><input type=text name=text1 value="123"> 15. 判断上一页的来源javascript:document.referrer16. 最小化、最大化、关闭窗口<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> <param name="Command" value="Minimiz
46、e"></object><object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> <param name="Command" value="Maximize"></object><OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><PARAM NAME="Comm
47、and" value="Close"></OBJECT><input type=button value=最小化 onclick=hh1.Click()><input type=button value=最大化 onclick=hh2.Click()><input type=button value=关闭 onclick=hh3.Click()>本例适用于IE17.屏蔽功能键Shift,Alt,Ctrl<script>function look() if(event.shiftKey) alert(
48、"禁止按Shift键!" /可以换成ALTCTRL document.onkeydown=look; </script>18. 网页不会被缓存<META HTTP-EQUIV="pragma" CONTENT="no-cache"><META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"><META HTTP-EQUIV="expires" CONTENT
49、="Wed, 26 Feb 1997 08:21:57 GMT">或者<META HTTP-EQUIV="expires" CONTENT="0">19.怎样让表单没有凹凸感?<input type=text style="border:1 solid #000000"> 或<input type=text style="border-left:none; border-right:none; border-top:none; border-bottom: 1 soli
50、d #000000"></textarea>20.<div><span>&<layer>的区别? <div>(division)用来定义大段的页面元素,会产生转行 <span>用来定义同一行内的元素,跟<div>的唯一区别是不产生转行 <layer>是ns的标记,ie不支持,相当于<div>21.让弹出窗口总是在最上面:<body>22.不要滚动条? 让竖条没有: <body style=overflow:-Scroll;overflow-y:h
51、idden> </body> 让横条没有: <body style=overflow:-Scroll;overflow-x:hidden> </body> 两个都去掉?更简单了 <body scroll="no"> </body> 23.怎样去掉图片链接点击后,图片周围的虚线?<a href="#"><img src="logo.jpg" border=0></a>24.电子邮件处理提交表单<form name="fo
52、rm1" method="post" action="mailto:*.com" enctype="text/plain"> <input type=submit></form>25.在打开的子窗口刷新父窗口的代码里如何写?window.opener.location.reload()26.如何设定打开页面的大小<body>打开页面的位置<body>27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动 <style> body background-
53、image:url(logo.gif); background-repeat:no-repeat; background-position:center;background-attachment: fixed </style> 28. 检查一段字符串是否全由数字组成<script language="javascript"><!-function checkNum(str)return str.match(/D/)=nullalert(checkNum("1232142141"alert(checkNum("12
54、3214214a1"/ -></script>29. 获得一个窗口的大小document.body.clientWidth; document.body.clientHeight30. 怎么判断是否是字符if (/x00-/xff/g.test(s) alert("含有汉字"else alert("全是字符"31.TEXTAREA自适应文字行数的多少<textarea rows=1 name=s1 cols=27></textarea>32. 日期减去天数等于第二个日期<script langua
55、ge=javascript>function cc(dd,dadd)/可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(A)alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日"cc("12/23/2002",2)</script>33. 选择了哪一个Radio<HTML
56、><script language="vbscript">function checkme()for each ob in radio1if ob.checked then window.alert ob.valuenextend function</script><BODY><INPUT name="radio1" type="radio" value="style" checked>style<INPUT name="radio1"
57、 type="radio" value="barcode">Barcode<INPUT type="button" value="check"></BODY></HTML>34.脚本永不出错<SCRIPT LANGUAGE="javascript"> <!- Hide function killErrors() return true; window.onerror = killErrors; / -> </SCRIPT&g
58、t;35.ENTER键可以让光标移到下一个输入框<input>36. 检测某个网站的链接速度:把如下代码加入<body>区域中:<script language=javascript>tim=1setInterval("tim+",100)b=1var autourl=new Array()autourl1="autourl2=""autourl3="autourl4="autourl5=" function butt()document.write("<form
59、 name=autof>"for(var i=1;i<autourl.length;i+)document.write("<input type=text name=txt"+i+" size=10 value=测试中> =<input type=text name=url"+i+" size=40> =<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br>
60、;"document.write("<input type=submit value=刷新></form>"butt()function auto(url)document.forms0"url"+b.value=urlif(tim>200)document.forms0"txt"+b.value="链接超时"elsedocument.forms0"txt"+b.value="时间"+tim/10+"秒"b+func
61、tion run()for(var i=1;i<autourl.length;i+)document.write("<img src=http:/"+autourl+"/"+Math.random()+" width=1 height=1 onerror=auto(http:/"+autourl+")>"run()</script>37. 各种样式的光标auto :标准光标default :标准箭头hand :手形光标wait :等待光标text :I形光标vertical-text
62、:水平I形光标no-drop :不可拖动光标not-allowed :无效光标help :?帮助光标all-scroll :三角方向标move :移动标crosshair :十字标e-resizen-resizenw-resizew-resizes-resizese-resizesw-resize38.页面进入和退出的特效进入页面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">推出页面<meta http-equiv="
63、Page-Exit" content="revealTrans(duration=x, transition=y)"> 这个是页面被载入和调出时的一些特效。Duration表示特效的持续时间,以秒为单位。Transition表示使用哪种特效,取值为1-23:0 矩形缩小 1 矩形扩大 2 圆形缩小3 圆形扩大 4 下到上刷新 5 上到下刷新6 左到右刷新 7 右到左刷新 8 竖百叶窗9 横百叶窗 10 错位横百叶窗 11 错位竖百叶窗12 点扩散 13 左右到中间刷新 14 中间到左右刷新15 中间到上下16 上下到中间 17 右下到左上18 右上到左下 1
64、9 左上到右下 20 左下到右上21 横条 22 竖条 23 以上22种随机选择一种39.在规定时间内跳转<META http-equiv=V="REFRESH" content="5;URL="> 40.网页是否被检索<meta name="ROBOTS" content="属性值">其中属性值有以下一些:属性值为"all": 文件将被检索,且页上链接可被查询;属性值为"none": 文件不被检索,而且不查询页上的链接;属性值为"index
65、": 文件将被检索;属性值为"follow": 查询页上的链接;属性值为"noindex": 文件不检索,但可被查询链接;属性值为"nofollow": 文件不被检索,但可查询页上的链接。 41.变换网页的鼠标光标<BODY style="CURSOR: url(05/liangmi2/farmfrog01.cur)">42.怎样实现在任务栏显示小图标的效果? (要使用绝对地址)有些站点,访问时会在地址栏地址前显出小图标,添加到收藏夹后也在收藏栏中显示图标,这样很好的与其它站点有了区别。 要达到这个效果,先需做出这个图标文件,图像为16*16像素,不要超过16色。文件格式为ico,然后上传至你的网站。然后,在需要的页面中,加上以下html语句到文件的<head>和</head>之间(假设以上ico文件的地址<link REL="SHORTCUT ICON"href="http:/ 如果访问者的浏览器是IE5.0,就不需加任何代码,只要将图标文件上传到网站的根目录下即可。1,META标签里的代码是什么意思? <META>是放于<HE
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 山西省运城市闻喜县部分学校2025-2026学年七年级上学期期末测试生物试卷(含答案)
- 2025跨年元旦新年春节烟花市集(请你看烟花)活动策划方案
- 餐厅人员介绍
- 12月十大金股:十二月策略和十大金股
- 飞机配送员培训课件大全
- 2026年滨州阳信县事业单位公开招聘人员(30人)备考考试试题及答案解析
- 2026年上半年黑龙江事业单位联考省科学院招聘24人备考考试试题及答案解析
- 食品安全管理人员制度
- 2026山东事业单位统考滨州市东平县初级综合类岗位招聘78人备考考试试题及答案解析
- 食品公司营销管理制度(3篇)
- 2020海湾消防GST-DJ-N500-GST-DJ-N900 消防设备电源状态监控器安装使用说明书
- 河北省沧州市青县2024-2025学年七年级上学期期末生物试卷
- 淮安市2022-2023学年七年级上学期期末地理试题
- 2024届高考语文二轮复习专题-文言文阅读(上海专用)(解析版)
- 2024可打印的离婚协议书模板
- EPC项目组织架构图
- 《房颤的药物治疗》课件
- 租赁手机筹资计划书
- 疾病产生分子基础概论
- 演示文稿第十五章文化中心转移
- 医疗设备购置论证评审表
评论
0/150
提交评论