js教程(有很多例子,大家可以参考)(编辑修改稿)内容摘要:

=Submit /form /body /html 输入特定长的字符才能提交表单 html head script type=text/javascript function validate() { x= input= if (5) { alert(The field cannot contain more than 5 characters!) return false } else { return true } } /script /head body form name=myForm action= onsubmit=return validate() Enter some text (you will get a message if you add more than 5 characters): input type=text name=myInput size=20 input type=submit value=Submit /form /body /html 对表单的检测 html head script type=text/javascript function validate() { x= at=(@) code= firstname= submitOK=True if (at==1) { alert(Not a valid !) submitOK=False } if (code1 || code5) { alert(The value must be between 1 and 5) submitOK=False } if (10) { alert(Your name must be less than 10 characters) submitOK=False } if (submitOK==False) { return false } } /script /head body form name=myForm action= onsubmit=return validate() Enter your input type=text name= size=20br / Enter a value from 1 to 5: input type=text name=code size=20br / Enter your name, max 10 chararcters: input type=text name=fname size=20br / input type=submit value=Submit /form /body /html 设置表单中的一项获得焦点 html head script type=text/javascript function setfocus() { [0].() } /script /head body form input type=text name=field size=30 input type=button value=Set focus onclick=setfocus() /form /body /html 选择文本框中的文本 html head script type=text/javascript function setfocus() { [0].() [0].() } /script /head body form input type=text name=txt size=30 value=Hello World! input type=button value=Select text onclick=setfocus() /form /body /html 下拉列表框的取值 html head script type=text/javascript function put() { txt=[0].[[0].].text [0].=txt } /script /head body form Select your favorite browser: select name=myList onchange=put() optionInter Explorer/option optionNetscape/option optionOpera/option /select br /br / Your favorite browser is: input type=text name=favorite size=20 /form /body /html 单选按钮的取值 html head script type=text/javascript function check(browser) { [0].=browser } /script /head body form Select which browser is your favorite:br /br / input type=radio name=browser onclick=check() value=Inter ExplorerInter Explorerbr / input type=radio name=browser onclick=check() value=NetscapeNetscapebr / input type=radio name=browser onclick=check() value=OperaOperabr / br / input type=text name=answer size=20 /form /body /html 下拉列表的值的显示 html head script type=text/javascript function put() { option=[0].[[0].dIndex].text txt=[0]. txt=txt + option [0].=txt } /script /head body form Select numbers:br / select name=dropdown option0/option option1/option option2/option option3/option option4/option option5/option option6/option option7/option option8/option option9/option /select input type=button onclick=put() value= input type=text name=number size=20 /form /body /html 下拉列表的连接 html head script type=text/javascript function go(form) { location= } /script /head body form select name=selectmenu onchange=go() optionSelect page/option option value= option value= option value=w3 /select /form /body /html 光标自动跳到下一个文本区 html head script type=text/javascript function toUnicode(elmnt,content) { if (==) { next= if (next[0].) { [0].elements[next].focus() } } } /script /head body pThis script automatically jumps to the next input field when the current field39。 39。 s maxlength has been reached./p form input size=3 tabindex=1 maxlength=3 onkeyup=toUnicode(this,) input size=3 tabindex=2 maxlength=3 onkeyup=toUnicode(this,) input size=3 tabindex=3 maxlength=3 onkeyup=toUnicode(this,) /form /body /html Frame, Frameset 和 IFrame 对象 平分两个页面 html frameset id=myFrameset cols=50%,50% frame id=leftFrame src= frame id=rightFrame src= /frameset /html html head script type=text/javascript function disableResize() { (leftFrame).noResize=true (rightFrame).noResize=true } function enableResize() { (leftFrame).noResize=false (rightFrame).noResize=false } /script /head body bgcolor=EFE7D6 form input typ。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。