1.文本框焦点问题onBlur:当失去输入焦点后产生该事件onFocus:当输入获得焦点后,产生该文件Onchange:当文字值改变时,产生该事件Onselect:当文字加亮后,产生该文件inputtype=textvalue=郭强onfocus=if(value=='郭强'){value=''}onblur=if(value==''){value='郭强'}点击时文字消失,失去焦点时文字再出现2.网页按钮的特殊颜色inputtype=buttonname=Submit1value=郭强size=10class=s02style=background-color:rgb(235,207,22)3.鼠标移入移出时颜色变化inputtype=submitvalue=找吧name=B1onMouseOut=this.style.color=blueonMouseOver=this.style.color=redclass=button4.平面按钮inputtype=submitvalue=订阅style=border:1pxsolid:#666666;height:17px;width:25pt;font-size:9pt;BACKGROUND-COLOR:#E8E8FF;color:#666666name=submit5.按钮颜色变化inputtype=textname=nickstyle=border:1pxsolid#666666;font-size:9pt;height:17px;BACKGROUND-COLOR:#F4F4FF;color:#ff6600size=15maxlength=166.平面输入框inputtype=textname=T1size=20style=border-style:solid;border-width:17.使窗口变成指定的大小scriptwindow.resizeTo(300,283);/script8.使文字上下滚动marqueedirection=upscrollamount=1scrolldelay=100onmouseover='this.stop()'onmouseout='this.start()'height=60!--head_scrolltext--trtd共和国/table!--endhead_scrolltext--/marquee9.状态栏显示该页状态baseonmouseover=window.status='网站建设可以点击文字实现radio选项的选定br inputtype=radioname=regtypevalue=A03id=A03labelfor=A03情侣:一次注册两个帐户/labelbr11.可以在文字域的font写onclick事件12.打印/a打印网页ahref='javascript:window.print()'13.线型输入框inputtype=textname=keysize=12value=关键字onFocus=this.select()onMouseOver=this.focus()class=line14.显示文档最后修改日期scriptlanguage=javascriptfunctionhi(str){document.write(document.lastModified)alert(hi+str+!)}/script15.可以在鼠标移到文字上时就触发事件htmlheadscriptlanguage=LiveScript!--Hidingfunctionhello(){alert(哈罗!);}/script/headbodyahref=onMouseOver=hello()link/a/body/html16.可以根据网页上的选项来确定页面颜色HTMLHEADTITLEbackground.html/TITLE/HEADSCRIPT!--functionbgChange(selObj){newColor=selObj.options[selObj.selectedIndex].text;document.bgColor=newColor;selObj.selectedIndex=-1;}//--/SCRIPTBODYSTYLE=font-family:ArialBChangingBackgroundColors/BBRFORMSELECTSIZE=8onChange=bgChange(this);OPTIONRedOPTIONOrangeOPTIONYellowOPTIONGreenOPTIONBlueOPTIONIndigoOPTIONVioletOPTIONWhiteOPTIONpink/SELECT/FORM/BODY/HTML17.将按钮的特征改变styletype=text/CSS!--.style1{font-size:12px;background:#CCCCFF;border-width:thinthinthinthin;border-color:#CCCCFF#CCCCCC#CCCCCC#CCCCFF}.style2{font-size:12px;font-weight:bold;background:#CCFFCC;border-width:thinmediummediumthin;border-color:#CCFF99#999999#999999#CCFF99}--/style本例按钮的代码如下:inputtype=submitname=Submitvalue=提交onmouseover=this.className='style2'onmouseout=this.className='style1'class=style118.改变按钮的图片.styletype=text/css!--.style3{font-size:12px;background:url(image/buttonbg1.gif);border:0px;width:60px;height:22px}.style4{font-size:12px;font-weight:bold;background:url(image/buttonbg2.gif);border:0px0;width:60px;height:22px}--/style本例的按钮代码如下:inputtype=submitname=Submit2value=提交onmouseover=this.className='style4'onmouseout=this.className='style3'class=style319.打印页面divalign=centeraclass=contenthref=javascript:doPrint();打印本稿/a/div20.可以直接写html语言document.write();21.改变下拉框的颜色selectname=classidonChange=changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)size=1style=color:#008080;font-size:9pt22.转至目标URLwindow.location=('guoqiang99267',this.form)functionUpdateSN(strValue,strForm){strForm.SignInName.value=strValue;returnfalse;}24.文字标签labelfor=AltName4inputname=AltNametype=RADIOtabindex=931id=AltName4guoqiang99859/label25.layer2为组件的ID,可以控制组件是否可见document.all.item('Layer2').style.display=block;document.all.item('Layer2').style.display=none;//26.将页面加入favorite中scriptlanguage=javascript!--functionAddme(){url=你自己的主页地址title=YourSiteName;//你自己的主页名称window.external.AddFavorite(url,title);--/script//27.过10秒自动关闭页面scriptlanguage=JavaScriptfunctioncloseit(){setTimeout(self.close(),10000)}/script28.可以比较字符的大小char=post.charAt(i);if(!('0'=char&&char='9'))29.将字符转化为数字month=parseInt(char)30.点击value非空的选项时转向指定连接selectonchange='if(this.value!=)window.open(this.value)'class=textinputoptionselected主办单位/optionoption-----------------/optionoptionvalue=北京日报/optionoptionvalue=北京晚报/option/select31.改变背景颜色tdwidth=*class=dpbgColor=#FAFBFConmouseover=this.bgColor='#FFFFFF';onmouseout=this.bgColor='#FAFBFC';32.改变文字输入框的背景颜色style.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}/styleinputname=contenttype=textsize=47class=input2maxlength=5033.改变水平线的特征hrsize=0noshadecolor=#C0C0C034.传递参数的方式ahref=vote.asp?CurPage=8&id=34888/a35.页内跳转ahref=#11/aahref=#22/aahref=#33/aahref=#44/aahref=#55/aahref=#66/aahref=#77/aaname=1dfdf/aaname=2dfdf/a//36.两个按键一起按下if(event.ctrlKey&&window.event.keyCode==13)//37.刷新