close

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 發表在 痞客邦 留言(0) 人氣()