JavaScript 基本類 使用onClick 及 this取得id


關鍵詞(keyword): onClick 、this、id


基本用法:

<script type="text/javascript">
function myMsg(myObj){

alert("id 為: " + myObj.id);
}
</script>
<input type="button" id="myButton" name="mybutton" value="送出" onclick="myMsg(this)">

 
結果:
 



 






 















其它文章

arrow
arrow
    創作者介紹
    創作者 PG Levin Li 的頭像
    PG Levin Li

    程式開發學習之路

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