我的Javascript语法错误

时间:2014-03-03 16:59:22

标签: javascript

我的Javascript代码出现语法错误,我无法找到问题所在:

<script type="text/javascript">
   function display(id,type){
    alert("Hi");    
   }
</script>

onclick事件如下:

<map name="Map" id="Map">
  <area shape="rect" coords="24,165,133,182" href="#" onclick="display("#td1","show")" />
  <area shape="rect" coords="23,190,167,209" href="#" />
  <area shape="rect" coords="23,218,165,235" href="#" />
  <area shape="rect" coords="22,242,165,261" href="#" />
  <area shape="rect" coords="23,268,164,286" href="#" />
</map>

1 个答案:

答案 0 :(得分:2)

将报价更改为单引号

<area shape="rect" coords="24,165,133,182" href="#" onclick="javascript:display('#td1','show')" />