close
[JavaScript-基本類]取出HTML的input元件的資料

說明:
取出HTML的input元件的資料,
在input輸入框輸入資料,
按下按扭,顯示輸入的資料。

程式:
<body>
<script type="text/javascript">
function myFun(){
myTxt = document.myForm.myText;
alert("你輸入的值:"+myTxt.value);
}
</script>
<form name="myForm">
<input type="text" name="myText" value="">
<input type="button" value="請點擊" onClick="myFun()">
</form>
</body>


圖:






















其它文章

arrow
arrow
    全站熱搜

    PG Levin Li 發表在 痞客邦 留言(0) 人氣()