欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          html中focus的用法是什么

          在html中,focus是“焦點”的意思,focus()方法用于為元素設(shè)置焦點,語法為“HTMLElementObject.focus()”;元素通過focus()方法設(shè)置的焦點,可以通過blur()方法進行移除。

          html中focus的用法是什么

          本教程操作環(huán)境:windows10系統(tǒng)、html5&&javascript1.8.5版、Dell G3電腦。

          html中focus的用法是什么

          focus() 方法用于為元素設(shè)置焦點(如果可以設(shè)置)。

          語法為:

          HTMLElementObject.focus()

          示例如下:

          <html> <head> <meta charset="utf-8"> <title>123</title> </head> <body> <input type="text" id="myText" value="文本域"> <p>點擊按鈕設(shè)置或移除以上文本域的焦點。</p> <input type="button" onclick="getfocus()" value="獲取焦點"> <input type="button" onclick="losefocus()" value="移除焦點"> <script> function getfocus() {     document.getElementById("myText").focus(); } function losefocus() {     document.getElementById("myText").blur(); } </script> </body> </html>

          輸出結(jié)果:

          html中focus的用法是什么

          推薦教程:《html視頻教程》

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號