开发者

Cannot call Javascript function

please look at the following sample code:

<html>
   <head>
       <script type="text/javascript">
    function myfun()
    {
        alert('hi');
    }
       </script>
   </head>
   <body>
        <h1> Hello </h1>
    <input type="button" value="MyButton" onClick="myfun()"/>
   </body>
</html>  

When I run this using php, and when I click on the button, the alert box doesn't come up. However, if I write oncl开发者_StackOverflowick="alert(hi')" it works fine. What might be the reason?


<html>

   <body>
        <h1> Hello </h1>
    <input type="button" value="MyButton" onClick="alert('hi')"/>
   </body>
</html>  

Missing a ' in your code...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜