這篇文章主要介紹了JavaScript獲得表單target屬性的方法,涉及javascript操作表單屬性的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了JavaScript獲得表單target屬性的方法。分享給大家供大家參考。具體實現方法如下:
- <!DOCTYPE html>
- <html>
- <body>
- <form id="frm1" action="form_action.asp" target="_blank">
- First name: <input type="text" name="fname" value="Donald"><br>
- Last name: <input type="text" name="lname" value="Duck"><br>
- <input type="submit" value="Submit">
- </form>
- <p>The value of the target attribute is:
- <script>
- document.write(document.getElementById("frm1").target);
- </script>
- </p>
- </body>
- </html>
上述代碼輸出結果如下:
- The value of the target attribute is: _blank
希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答
圖片精選