(一)aspx页面上的代码片段
<body>
<script language="javascript" type="text/javascript">
    function DisplayBehindCode() {
    var text=<%=Name() %>;
    alert(text);
    }
</script>
....
<asp:Button ID="Button1" OnClientClick="DisplayBehindCode()" runat="server"  Text="Button" Visible="true" />
</body>
(二)aspx.cs后台代码
    public string Name()
    {
        string name = "canyong";
        return (name);
    }

运行后报错:
     出现运行时间错误,是否要进行需要调试?
     错误:'canyong'未定义

相关文章:

  • 2021-08-13
  • 2022-12-23
  • 2020-03-20
  • 2022-12-23
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2022-02-26
  • 2021-10-12
相关资源
相似解决方案