多个网页设计常用技巧代码_第1页
多个网页设计常用技巧代码_第2页
多个网页设计常用技巧代码_第3页
多个网页设计常用技巧代码_第4页
多个网页设计常用技巧代码_第5页
已阅读5页,还剩25页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1. 文 本 框 焦点 八、八、 问 题 onBlur: 当 失 去 输 入焦 点后 产生 该 事 件 onFocus: 当 输 入 获 得焦 点后, 产生 该 文 件 Onchange: 当 文 字 值改 变时, 产生 该 事 件 Onselect: 当 文 字 加亮 后, 产生 该 文 件 点击 时文字 消失,失去 焦点时 八、八、L J 文字再出 现 2. 网 页 按 钮 的 特 殊 颜 色 3. 鼠 标 移 入 移 出 时 颜 色 变 化 4. 平 面 按 钮 5. 按 钮 颜 色 变 化 6. 平 面输 入框 7. 使 窗 口 变 成指定 的大小 window.resizeTo(30

2、0,283) 。 8. 使 文 字上 下 滚动 marquee direction=up scrollamount=1 scrolldelay=100 onmouseover=this.stop() onmouseout=this.start() - !- 国 end head_scrolltext - 状态 return true 状 base onmouseover=window.status= 9. 10. 以点击文 label type=radio 情 11. 12. a 13. input type=text onMouseOver=this.focus() name=key 14.

3、 显 示 15. 可 在鼠 该 网站建设 http:/ 字实现 radio 选 name=regtype 一次注 域的 nrt 册 font 页 / 。 的选定 value=A03 个 帐 户 写 onclick 印 href=javascript:window.print size=12 id=A03 页 () 型 value= 关 键 字 onFocus=this.select() class=line 文档 script 标移到 hi(str) document.write(document.lastModified) 最后 function 文字上 时就 !- function ale

4、rt(hi+str+!) 触发事件 language=Livescript Hiding hello() alert( !) link 16. 可以根据 网页上 的选项来确定页面颜色 background.html !- function bgChange(selObj) newColor selObj.optionsselObj.selectedIndex.text document.bgColor selObj.selectedIndex newColor。 -1。 BODY Changing STYLE=font-family:Arial Background Colors onChan

5、ge=bgChange(this) 。 Red Orange Yellow Green Blue Indigo Violet White pink 17. 钮的 !- .style1 font-size: 12px 。 background: thin .style2 font-size: 12px 。 thin medium #CCCCCC font-weight: bold border-color: #CCFF99 #CCCCFF 。 border-width: border-color: thin thin thin #CCCCFF 本 input type=submit onmous

6、eover=this.className=style2 18. #CCCCCC 。 background: #CCFFCC medium #999999 钮的 name=Submit onmouseout=this.className=style1 按钮 下: 交 class=style1 图片. type=text/css 本例 input type=submit onmouseover=this.className=style4 按钮 的 name=Submit2 代码 value= 下: 交 class=style3 19 .打 印 div align=center 打 印 本 稿 20

7、. 可 以 直接写 document.write() html 语 言 。 21. 改 变 下拉框 的 颜 色 onChange=changelocation(document.myform.classid.optionsdocument.myform.classid. selectedIndex.value) size=1 style=color:#008080 。 font-size: 9pt 22. 转 至 目标 URL window.location=http:/guoguo 23. 传递 该 object 的 form UpdateSN(guoqiang99267,this.form

8、) function UpdateSN(strValue,strForm) strForm.SignInName.value = strValue 。 return false 。 24. 文 字 标签 guoqiang99859 25.layer2 为 组 件 的 ID , 可以控 制 组 件是否 可 见 document.all.item(Layer2).style.display = block 。 document.all.item(Layer2).style.display = none 。 / 26. 将 页 面 加 入 favorite 中 / 27. 过 10 秒 自 动关闭

9、页面 function closeit() setTimeout(self.close() 10000) /script 28. 可 以 比 较字符 的大小 char=post.charAt(i) 。 if(!(0=char&char=9) 29. 将 字 month 符 转 化 为数字 parseInt(char) 30. 点 击 value 非空 的 选项 时转 向指定连接 主 办 单 位 北 京 日报 北 京 晚报 31. 改 变 匕 背 景 颜 色 td width=* class=dp bgColor=#FAFBFC onmouseover=this.bgColor=#FFFFFF

10、onmouseout=this.bgColor=#FAFBFC 32. 改 变 文 字输入框的 背景 .input2 background-image: background-color: url(./images/inputbg.gif)。 font-size: 颜 12px 。 #D0DABB 。 border-top-width:1px 1px 。 border-left-width: 1px name=content type=text size=47 class=input2 maxlength=50 33. 改 变 水 平线 的特征 34. 传 递 参 数 的方式 8 35. 页

11、内 跳转 1 2 3 4 5 1px 。 border-bottom-width: input 。 border-right-width: a a a 6 href=#77 name=1dfdf name=2dfdf/ 36. 38. for(var if(event.ctrlKey 37. & 一起 window.event.keyCode=13)/ i=0 script 新页 javascript:this.location.reload()/ function i haha() i+) 台匕 能 if(.indexOf(bb)!=

12、-1) document.form1.elementsi.disabled=!document.form1.elementsi.disabled form name=form1 INPUT TYPE=button NAME=aa value=cindy II INPUT TYPE=button NAME=bb value=guoguo value=guoguo 39. marquee scrollamount=3 文 onmouseover=this.stop() 移 onmouseout=this.start() 40. 击 currentpos,timer function initial

13、ize() timer=setInterval(scrollwindow(),1) function sc() clearInterval(timer) function scrollwindow() window.scroll(0,+currentpos)。 if (currentpos != document.body.scrollTop) sc()。 document.onmousedown=sc document.ondblclick=initialize / 41. value=back INPUT TYPE=button onclick=window.history.back()

14、转 document.location=http:/ww 44. 或者 向指定 document.location.assign( 网 http:/ 页 ) 45. 在 网 页 clock_id window.onload=function() 时时 clock_id=setInterval(document.form1.txtclock.value=(new Date) 。 ,1000) / 46. 可 document.location.href= 47. 件 / String import myDBDriver=sun.jdbc.odbc.JdbcOdbcDriver Class.for

15、Name(myDBDriver) java.sql.* Connection conn=DriverManager.getConnection(jdbc:odbc:firm,username,password) Statementstmt=conn.createStatement() ResultSet rs=stmt.executeQuery(sql) rs.getString(column1) / 48. 可 以 直 接 在 页 面 “div ”内 写 下 所 需 内 容 INPUT TYPE=button onclick=a1.innerHTML=* 49. 可 以 改 变 页 面上 连

16、接的格式 A:link text-decoration: A:visited text-decoration: A:hover text-decoration: none none color:#0000FF 。 color: #0000FF underline overline 使其为双线 宋体 宋 体 FF0000 font-family: font-family: color: A:link A:visited A:hover text-decoration: text-decoration: text-decoration: none none underline color:#000

17、0FF 。 color: #0000FF overline line-through THFONT-SIZE: TDFONT-SIZE: font-family: font-family: 。 color: 宋体 宋 体 FF0000 9pt 9pt body SCROLLBAR-FACE-COLOR: #A9D46D 。 SCROLLBAR-HIGHLIGHT-COLOR: #e7e7e7 。 SCROLLBAR-SHADOW-COLOR:#e7e7e7 SCROLLBAR-3DLIGHT-COLOR: #000000 。 LINE-HEIGHT: 15pt 。 SCROLLBAR- ARR

18、OW-COLOR: #ffffff SCROLLBAR-TRACK-COLOR: #e7e7e7 INPUTBORDER-TOP-WIDTH: 1px 。 PADDING-RIGHT: 1px 。 1px 。 BORDER-LEFT-WIDTH: 1px 。 PADDING-LEFT: FONT-SIZE: 9pt 。 BORDER-LEFT-COLOR: #cccccc 。 BORDER-BOTTOM-WIDTH: 1px 。 BORDER-BOTTOM-COLOR: #cccccc 。 PADDING-BOTTOM: 1px 。 BORDER-TOP-COLOR: #cccccc 。 PA

19、DDING-TOP: 1px 。 HEIGHT: 18px 。 BORDER-RIGHT-WIDTH: 1px RIGHT-COLOR: DIV,form textarea, select border-width: #efefef ,OPTION,P ,TD,BRFONT-FAMILY: 宋 体 。 border-color: #000000 宋 1。 。 BORDER- font-family: #cccccc FONT-SIZE: 9pt background-color: 体 。 font-style: .text font-family: 宋体 。 font-size: 9pt 。

20、color: #003300 。 border-width: 1px font-size: 9pt bold border: #006600 solid 1px 1px 1px 宀 完 整 的 css 50. frame 51. 向 文 件 中写 内 容 52. 先 读 文件 再写文 件 eryrytry 54. 可 以 将 背 景 改 为 按 钮 性 状 , 通过 录音笔 55. 同 时 按 下 CTRL 和 .mouseoverbt background-image: url( http:/ ) 。 background-repeat: no-repeat 。 .mouseout back

21、ground-color: #E0E0E0 。 document.onkeydown=function() if(event.ctrlKey&event.keyCode=81) alert(1) / 56. 以下是一个完整的显示 hint 的代码,其思想是当鼠标停留是将 div 中的内容显示在 鼠标出 当 鼠 标 移 出 后 在 将 该 div #hint border:1px top: script width:198px。 solid #000000 。 background:#99ff33。 position:absolute。 z-index:9。 padding:6px。 line-

22、height:17px。 text-align:left。 1520px。 LANGUAGE=Javascript function div id=hint dfdfd style=display:none 出窗口 浏览器读页面时弹出窗口; 浏览器离开页面时弹出窗口; 方法三: 用一个连接调用: 打开 一个窗口 注意: 使 用 的 # 是 虚 连 接 。 方法四: 用一个按钮调用: 何 时装载 script 57. 弹 方法一 : 方法二 : 58. 动 态 改变字 体 的大小 function doZoom(size) document.getElementById(zoom).style.

23、fontSize=size+px var newWin=window.open(url) 。 newWin.document.form1.text1.value=value1 。 改变弹出窗 口上域的 属 性 opener.document.form2.text2.value=value2 。改变父窗口的 域的 值 function aa() 断 是何种浏 览器 name = navigator.appName 。 = = Microsoft Internet Explorer) alert(IE) 。 if (name = Netscape) alert(NS) 。 / 59. 判 var

24、if(name else 定框 language=VBscript !- 吗 ? , 4 60.vbsscript 确 61. 容 function var o b=eval(document.form1.+bb) ob.select() js=ob.createTextRange() js.execCommand(Copy) 62.java 中建立 public 库连接 void String url=jdbc:odbc:javadata Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) Connection con=DriverManager.getC

25、onnection(url,sa,) SAand DatabaseMetaData System.out.println(Connect System.out.println( System.out.println( 。 /mssql Statement ResultSet rs=stmt.executeQuery(select number=1) String System.out.println(dispresult) etc. / 切板 JM_cc(bb) database / 据 init() try user password dma=con.getMetaData() to+dma

26、.getURL() +dma.getDriverName() +dma.getDriverVersion() System.out.println() Driver Version stmt=con.createStatement() * from company.dbo.TB_NAME rs.next() dispresult=rs.getString(name) 。 / Instead,you can display it in Paint() rs.close() stmt.close() con.close() catch(SQLException System.out.println

27、(!SQL Exception System.out.println(SQLState:+ex.getSQLState() System.out.println(Message:+ex.getMessage() System.out.println(Vendor:+ex.getErrorCode() where /Sql or use AWT o ex) !) while(ex!=null) ex=ex.getNextException() System.out.println() 。 。 catch(java.lang.Exception ex) ex.printStackTrace() 。

28、 / 63. 最 小 化 窗口 window.blur()/ 64. 文 档 的 路径 document.URL/ 65. 定 时 执行 某 段程序 setTimeout(change_color(),600) 。 66. 设 置 为 主页 function makeHome() netscape.security.PrivilegeManager.enablePrivilege(UniversalPreferencesWrite) 。 navigator.preference(browser.startup.homepage, location.href) 。 / 67. 设 置 为 收藏

29、function addFav() if(ie) window.external.AddFavorite(location.href,WWW.OGRISH.COM : GROTESQUE MOVIES AND PICTURES) 。 if(ns) alert(Thanks for the bookmark!nnNetscape users click OK then press CTRL-D)。 / 68. 判 断 cookie navigator.cookieEnabled 是 否可用 。 / 69. 显 示 有 模式的有页 面 的弹出窗口 function setbgcolor_oncli

30、ck() if (color != null) pose.bgcolor.value color 。 / 70. 截 取小数 点 八、 后 两 位 vara=3454545.4454545 。 alert(a.toFixed(2) 。 / 71. 禁 止 选 择 页 面 上 function with returnValue cancelBubble body onselectstart=noEffect() 的文字来拷贝 noEffect() (event) =false。 =true。 return 。 oncontextmenu=noEffect()/ 72. 屏 蔽 右 onconte

31、xtmenu=event.returnValue 单 false/ 73. 事 件 禁 event.cancelBubble 起泡 true/ 74. 禁 止 在 输 入框打 input style=ime-mode: 75. 屏 蔽 汉 字 / 和空格 -|s/.test(txt.value)/ 76. 用 javascript 判断文件 function if var 是否存在 Exists(filespec) (filespec) fso。 fso new ActiveXObject(scripting.FileSystemObject) alert(fso.FileExists(fil

32、espec) 选 择 图 片 / 77. 获 得 当 前的文本 框选 中 的文字 / 78. 跳 转 至 目标页面, 同时 不 可返回 79. 前的 行是表格 的第 function 几行 getrow(obj) alert( if(event.srcElement.tagName=TD) curRow=event.srcElement.parentElement 这是第 +(curRow.rowIndex+1)+ ) 。 / 80. 删 除 表 格 某 行 , xx 表 示 某 行 , 下 标 从 0 开 始 计 算 document.all.myTable.deleteRow(xx)/ 8

33、1. 动 态的 向 表格 中添加行 function add() t1.insertRow().insertCell().innerHTML = 。 / 82.event.x,event.clientX,event.offsetX 区 别 : x:设置或者是得到鼠标相对于目标事件的父元素的外边界在x坐标上的位置。clientX: 相 对 于客户区 域 的 x 坐 标 位置 不 包括滚动条,就是正文区域。 offsetx : 设置或者是得到鼠标相对于目标事件的父元素 的 内 边界在 x 坐 标 上 的 位 置 。 screenX:相 对 于 用 户 屏 幕 。 83. 显 示 是 鼠 标 按 钮

34、 的 哪 个 点 Mouse 看 看 / 84. 打 开 C盘 / 85. 当前 屏 幕 的 分 辨率 screen.width 、 screen.height/ 86. 设置 表 格 中 的 内容 tbl.rows0.cells1.innerText=document.form.text1.value。/ 87. 本 地 快 捷 键 网上邻居 我的电脑 我的文档 回 收 站 控 制 面 板 拨号网络 (windows 2000) 88.IE 菜 0/ 图 / 新连 onclick=document.execCommand(print,true,true) onclick=document.e

35、xecCommand(saveas,true, 另存为 onclick=document.execCommand(saveas,true, 为 保 input input / type=button .txt)/ document.execCommand(SaveAs)/ document.execCommand(undo)/ 撤销 89.web 单 改变按钮上 片 创 接 / 打 印 站制 htm 站制 txt 为 作 框 var contents=body,tdfont:menuimgcursor:hand 闭 我 吗 bgcolor=menu height=100% border=0 align=center contents+= 你要 contents+=body contents+=table width=100% contents+= contents+=img contents+=img contents+=td 你要关 src=dark.gif src=jet.gif 我

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论