这就是我正在尝试的。调用内联js的函数。但我没有工作。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="javascript_Tutorials.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>javaScript Tutorials</title>
<script type="text/javascript" language="javascript">
function objects() {
alert("Well come");
}
</script>
</head>
<body>
<form runat="server" id="myform">
<asp:Button onclick="<% objects(); %>" runat="server" />
</form>
</body>
</html>
并出现以下错误:
CS1061:“ASP.webform1_aspx”不包含“对象”的定义,并且找不到接受“ASP.webform1_aspx”类型的第一个参数的扩展方法“对象”(您是否缺少 using 指令或程序集引用?)