<input type="button" onclick="setTimeout('alert(123);',100)" />
这条是OK的
但是如果alert(123)改为alert("123")这里要怎么写呢?
因为外面已经有了一个""了
<input type="button" onclick="setTimeout('alert("123");',100)" /> 这样不行
谢谢

解决方案 »

  1.   


    转义 alert(\"123\")
      

  2.   

    <input type="button" onclick="setTimeout('alert(\"123\");',100)" /> 
    这样也是报错
      

  3.   


    <input type="button" onclick="setTimeout('alert(\'123\')',100)" /> 
      

  4.   

    确实奇怪
        <input type="button" onclick="setTimeout('alert(\'123\')',1000)" /> 
      

  5.   

    <input type="button" value="点击" onclick="setTimeout(function(){alert('123')},100)" />