1、多个网页设计常用技巧代码1.文本框焦点问题 onBlur:当失去输入焦点后产生该事件 onFocus:当输入获得焦点后,产生该文件 Onchange:当文字值改变时,产生该事件 Onselect:当文字加亮后,产生该文件 点击时文字消失,失去焦点时文字再出现 2.网页按钮的特殊颜色 3.鼠标移入移出时颜色变化 4.平面按钮 5.按钮颜色变化 6.平面输入框 7.使窗口变成指定的大小 window.resizeTo(300,283)。 8.使文字上下滚动 共和国 9.状态栏显示该页状态 10.可以点击文字实现radio选项的选定 情侣 : 一次注册两个帐户 11.可以在文字域的font写oncl
2、ick事件 12.打印打印网页 13.线型输入框 14.显示文档最后修改日期 function hi(str) document.write(document.lastModified) alert(hi+str+!) 15.可以在鼠标移到文字上时就触发事件 !- Hiding function hello() alert(哈罗!)。 link 16.可以根据网页上的选项来确定页面颜色 background.html Changing Background Colors Red Orange Yellow Green Blue Indigo Violet White pink 17.将按钮的特
3、征改变 本例按钮的代码如下: 18.改变按钮的图片. 本例的按钮代码如下: 19.打印页面 打印本稿 20.可以直接写html语言 document.write()。 21.改变下拉框的颜色 22.转至目标URL window.location=http:/guoguo 23.传递该object的form UpdateSN(guoqiang99267,this.form) function UpdateSN(strValue,strForm) strForm.SignInName.value = strValue。 return false。 24.文字标签 guoqiang99859 25.
4、layer2为组件的ID,可以控制组件是否可见 document.all.item(Layer2).style.display = block。 document.all.item(Layer2).style.display = none。/ 26.将页面加入favorite中 / 27.过10秒自动关闭页面 function closeit() setTimeout(self.close(),10000) 28.可以比较字符的大小 char=post.charAt(i)。 if(!(0=char&char=9) 29.将字符转化为数字 month = parseInt(char) 30.点击
5、value非空的选项时转向指定连接 主办单位 - option value= option value= 31.改变背景颜色 32.改变文字输入框的背景颜色 .input2 background-image: url(./images/inputbg.gif)。 font-size: 12px。 background-color: #D0DABB。border-top-width:1px。 border-right-width: 1px。 border-bottom-width: 1px。 border-left-width: 1px 33.改变水平线的特征 34.传递参数的方式 8 35.页
6、内跳转 1 2 3 4 5 6 7 dfdf dfdf/ 36.两个按键一起按下 if(event.ctrlKey & window.event.keyCode=13)/ 37.刷新页面 javascript:this.location.reload()/ 38.将网页的按钮使能 function haha() for(var i=0。idocument.form1.elements.length。i+) if(document.form1.elementsi.name.indexOf(bb)!=-1) document.form1.elementsi.disabled=!document.f
7、orm1.elementsi.disabled。 39.文字移动 40.双击网页自动跑 var currentpos,timer。 function initialize() timer=setInterval(scrollwindow(),1)。 function sc() clearInterval(timer)。 function scrollwindow() currentpos=document.body.scrollTop。 window.scroll(0,+currentpos)。 if (currentpos != document.body.scrollTop) sc()。
8、document.onmousedown=sc document.ondblclick=initialize / 41.后退 42.前进 43.刷新 44.转向指定网页 document.location=http:/ww或者document.location.assign() 45.在网页上显示实时时间 var clock_id。 window.onload=function() clock_id=setInterval(document.form1.txtclock.value=(new Date)。,1000) / 46.可以下载文件 document.location.href=目标文
9、件/ 47.连接数据库 import java.sql.*。 String myDBDriver=sun.jdbc.odbc.JdbcOdbcDriver。 Class.forName(myDBDriver)。 Connection conn=DriverManager.getConnection(jdbc:odbc:firm,username,password)。 Statement stmt=conn.createStatement()。 ResultSet rs=stmt.executeQuery(sql)。 rs.getString(column1)。/ 48.可以直接在页面“div”
10、内写下所需内容 INPUT TYPE=button onclick=a1.innerHTML=* / 49.可以改变页面上的连接的格式,使其为双线 A:link text-decoration: none。 color:#0000FF。 font-family: 宋体 A:visited text-decoration: none。 color: #0000FF。 font-family: 宋体 A:hover text-decoration: underline overline。 color: FF0000 A:link text-decoration: none。 color:#0000
11、FF。 font-family: 宋体 A:visited text-decoration: none。 color: #0000FF。 font-family: 宋体 A:hover text-decoration: underline overline line-through。 color: FF0000 THFONT-SIZE: 9pt TDFONT-SIZE: 9pt body SCROLLBAR-FACE-COLOR: #A9D46D。 SCROLLBAR-HIGHLIGHT-COLOR: #e7e7e7。SCROLLBAR-SHADOW-COLOR:#e7e7e7。 SCROLL
12、BAR-3DLIGHT-COLOR: #000000。 LINE-HEIGHT: 15pt。 SCROLLBAR-ARROW-COLOR: #ffffff。 SCROLLBAR-TRACK-COLOR: #e7e7e7。 INPUTBORDER-TOP-WIDTH: 1px。 PADDING-RIGHT: 1px。 PADDING-LEFT: 1px。 BORDER-LEFT-WIDTH: 1px。 FONT-SIZE: 9pt。 BORDER-LEFT-COLOR: #cccccc。 BORDER-BOTTOM-WIDTH: 1px。 BORDER-BOTTOM-COLOR: #cccccc。 PADDING-BOTTOM: 1px。 BORDER-TOP-COLOR: #cccccc。 PADDING-TOP: 1px。 HEIGHT: 18px。 BORDER-
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2