它不起作用,我需要 onclick 基础而不是基于 id 的代码,请帮助我
<div onclick="favTheater(id)">
<img src="#"/>
</div>
<script type="text/javascript">
function favTheater(id){
alert("dsfdsf"+id);
var e = window.event;
e.stopPropagation();
e.preventDefault();
window.location.href="http://www.google.co.in/";
}
</script>