我写了这段代码:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script language="javascript" type="text/javascript">
// <![CDATA[
function btnClient_onclick() {
document.getElementById("lblClient").innerText = "Changed";
document.getElementById("lblServer").innerText = "Server";
}
// ]]>
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Welcome to ASP.NET!
</h2>
<p>
<asp:Button ID="btnServer" runat="server" onclick="btnServer_Click"
Text="Server" />
<asp:Label ID="lblServer" runat="server" Text="Server"></asp:Label>
</p>
<p>
<input id="btnClient" type="button" value="Client" onclick="return btnClient_onclick()" />
<asp:Label ID="lblClient" runat="server" Text="Client"></asp:Label>
</p>
</asp:Content>
当我运行它时,得到了这个错误:无法设置未定义或空引用的属性'innerText'