Java脚本你好世界程序错误 [英] Java script hello world program error

查看:137
本文介绍了Java脚本你好世界程序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm learning Javascript i try to write the "HelloWorld" Program it causes some errors like 

error: CS1026: ) expected

Line 18:     <form id="form1" runat="server">
Line 19:     <div>
Line 20:     <asp:Button runat="server" ID="btlDate" Text="Display Date"                          OnClick="javascript:dispdate();" />
Line 21:     </div>
Line 22:     </form>
 

 
do you know what could be wrong with this code?


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    <script type="text/javascript" language="javascript">
        function dispdate() 
        {
            alert("Hello World");
        }
    </script>
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Button runat="server" ID="btlDate" Text="Display Date" OnClick="javascript:dispdate();" />
    </div>
    </form>
</body>
</html>

推荐答案

^ ]是服务器端事件.

使用 OnClientClick [按钮OnClientClick属性 [
OnClick[^] is a Server side Event.

Use OnClientClick[^] instead of OnClick.

Another Example - Button OnClientClick Property[^]


这篇关于Java脚本你好世界程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆