例如,我在body上面的script里寫(xiě)了一個(gè)函數(shù)如果在body里有個(gè)input type="submit" value="調(diào)用函數(shù)a",點(diǎn)擊就能調(diào)用,但我將它改成div id="a" onclick="a()"調(diào)用函數(shù)a/div,為什么就調(diào)用不了了? <script>
function a(){
...
}
</script>
<body>
<form action="${pageContext.request.contextPath }/login.action"
method="post" onsubmit="return a()">
<input type="submit" value="調(diào)用函數(shù)a"/>
<!-- 沒(méi)法調(diào)用-->
<!--<div id="a" onclick="a()">調(diào)用函數(shù)a</div>-->
</form>
</body>
如何在點(diǎn)擊一個(gè)<div>時(shí)去執(zhí)行一個(gè)javascript里的函數(shù)?
叮當(dāng)貓咪
2018-07-23 12:23:41