以下代碼在IE中引發了兩次警報,但未在Firefox中引發。請幫忙。click()(javascript)方法在FF中不起作用
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function myFunction(){
alert('myfunc');
document.getElementById('mylabel').click();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<p id='mylabel' onclick="alert('you reached');"></p>
<input type='button' value="Click me" onclick='myFunction();'/>
</BODY>
</HTML>
感謝
Look http://stackoverflow.com/a/17633164/2777092 – KingRider 2016-12-20 10:23:23