在线
客服

在线客服
尊敬的客户,我们24小时竭诚为您服务 公司总机: 0755-83312037 (32条线)

客服
热线

0755-83312037 (32条线)
7*24小时客服服务热线

?

关注
微信

关注官方微信

返回
顶部

网页技巧:表单(textarea)有关焦点的用法

发布时间:2019-04-13浏览次数:296
<p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">网页制作Webjx文章简介:</font><font color="#000000">网页技巧:表单(textarea)有关焦点的用法.</font> </td> </tr></tbody></table> <h2>表单(<span class="wp_keywordlink_affiliate">textarea</span>)有关<span class="wp_keywordlink_affiliate">焦点</span>的用法大全</h2> <p>1.文本框显示默认文字:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_958077"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>2.鼠标点击文本框,默认文字消失:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_694819"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onfocus="if(value==’网页教学网-webjx.com’) {value=''}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onfocus="if(value==’网页教学网-webjx.com’) {value=''}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>3.鼠标移至文本框,默认文字消失:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_22032"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onmouseover="focus()" onfocus="if(value==’网页教学网-webjx.com’) {value=''}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onmouseover="focus()" onfocus="if(value==’网页教学网-webjx.com’) {value=''}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>4.鼠标点击文本框,默认文字消失,点击文本框外任意区域,默认文字又重现:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_783548"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onfocus="if(value==’网页教学网-webjx.com’) {value=''}" onblur="if(value=='') {value=’网页教学网-webjx.com’}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onfocus="if(value==’网页教学网-webjx.com’) {value=''}" onblur="if(value=='') {value=’网页教学网-webjx.com’}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>5.鼠标移至文本框,默认文字消失,鼠标移出文本框,默认文字又重现:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_667159"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onmouseover="focus()" onmouseout="blur()" onfocus="if(value==’网页教学网-webjx.com’) {value=''}" onblur="if (value=='') {value=’网页教学网-webjx.com’}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onmouseover="focus()" onmouseout="blur()" onfocus="if(value==’网页教学网-webjx.com’) {value=''}" onblur="if (value=='') {value=’网页教学网-webjx.com’}"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>6.鼠标单击文本框,文本框内任何文字消失(包括默认文字及后来输入的文字):</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_50835"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onclick="value=''"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onclick="value=''"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>7.鼠标移至文本框,文本框内任何文字消失(包括默认文字及后来输入的文字):</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_472900"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onmouseover="value=''"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onmouseover="value=''"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>8.单击文本框后全选文本框内的文字:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_502822"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onfocus="select()"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onfocus="select()"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>9.鼠标移至文本框全选文本框内的文字:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_592594"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onmouseover="focus()" onfocus="select()"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onmouseover="focus()" onfocus="select()"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>10.回车后<span class="wp_keywordlink_affiliate">焦点</span>从当前文本框转移到下一个文本框:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_837044"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> <div class="line number2 index1 alt1">2</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onkeydown="if(event.keyCode==13)event.keyCode=9"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> <div class="line number2 index1 alt1">&lt;textarea onkeydown="if(event.keyCode==13)event.keyCode=9"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div> <p>11.回车后<span class="wp_keywordlink_affiliate">焦点</span>从当前文本框转移到指定位置:</p> <div> <div class="syntaxhighlighter notranslate html ie" id="highlighter_100324"></div> <table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter"> <div class="line number1 index0 alt2">1</div> </td> <td class="code"> <div class="container"> <div class="line number1 index0 alt2">&lt;textarea onkeypress="return focusNext(this,’指定位置的id名称’,event)"&gt;网页教学网-webjx.com&lt;/textarea&gt;</div> </div> </td> </tr></tbody></table> </div>