JavaScript使表單中的內(nèi)容顯示在屏幕上的方法
更新時間:2015年06月29日 16:35:43 作者:林蛤蛤
這篇文章主要介紹了JavaScript使表單中的內(nèi)容顯示在屏幕上的方法,涉及javascript針對表單元素操作的相關(guān)技巧,需要的朋友可以參考下
本文實例講述了JavaScript使表單中的內(nèi)容顯示在屏幕上的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
一、使內(nèi)容水平出現(xiàn)
<html> <head> <title>測試</title> <script type="text/javascript"> function to() { var txt=document.getElementById("txt").value; document.getElementById("a").innerHTML+=txt; } </script> </head> <body> <div id="a">在這里顯示:</div> <button onclick="to();">輸入</button> </body> </html>
二、使內(nèi)容以表格形式出現(xiàn)
<html> <head> <title>測試</title> <script type="text/javascript"> function to() { var txt=document.getElementById("txt").value; var row=document.getElementById("ib").insertRow(); row.align="center"; var tt0=row.insertCell(); tt0.innerHTML=txt; } </script> </head> <body> <div id="a"></div> <table id="ib"> <tr> <th>content</th> </tr> </table> <input type="text" id="txt" value="" size="30"> <button onclick="to();">輸入</button> </body> </html>
希望本文所述對大家的javascript程序設(shè)計有所幫助。
相關(guān)文章
利用404錯誤頁面實現(xiàn)UrlRewrite的實現(xiàn)代碼
要求:網(wǎng)站編碼為utf-8,不適用于GB2312; 替換字符的正則可以自己增加和修改,以適合自己的網(wǎng)站;2008-08-08javascript 操作符(~、&、|、^、<<、>>)使用案例
這篇文章主要介紹了javascript 操作符(~、&、|、^、<<、>>)使用案例,非常的全面,需要的朋友可以參考下2014-12-12List the Codec Files on a Computer
List the Codec Files on a Computer...2007-06-06input鏈接頁面、打開新網(wǎng)頁等等的具體實現(xiàn)
input可以鏈接到某頁、返回、打開新網(wǎng)頁、打開無邊框的新窗口等等,本文整理了一些,感興趣的朋友可以參考下2013-12-12