我的主页在“服务器”等形式内:
<body>
<form id="Form1" runat="server">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</form>
</body>
在我的一页中,我增加了一个文本区域,一个纽州(html Control,而不是ASPs)和一些javascript代码,如:
<textarea id="ContentTextArea" class="ContentTextArea" rows="2" cols="20"></textarea>
<button id="ClearButton" class="Button2" onclick="ClearButtonClick();">CLEAR</button>
<script type="text/javascript">
function ClearButtonClick() {
document.getElementById("ContentTextArea").value = "";
}
</script>
我希望 j印法(正在清理正文体)在客户不向服务器发出要求的情况下点击“clear”纽扣时运行,但因为我有<form id=“Form1”prat=“server”>
在纽特纳总页将数据提交服务器并重载。
我必须拥有<代码><form id=“Form1”prat=“server”>载于我的主页,但我还要使用 JavaSctipt在客户方面操作的手法。
成就
EDIT:
我的主页是:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="Head1" runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="Form1" runat="server">
<div class="header">
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
<asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="Contact Us"/>
</Items>
</asp:Menu>
</div>
<div class="loginDisplay">
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
[ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
</LoggedInTemplate>
</asp:LoginView>
</div>
</div>
<div class="clear">
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="footer">
<p>GH Electronics © 2012. All Rights Reserved.</p>
</div>
</form>
<input type="button" onclick="window.location = /WareHouse/ContactUs.aspx ;" value="avi"/>
<script type="text/javascript">
function ClearButtonClick() {
document.getElementById("ContentTextArea").value = "";
return false;
}
</script>
</body>
</html>
我与我们的联系形式是:
<img alt="Contact Us" src="Images/contact_us.gif" style="float:left;"/> <p class="contactUs" runat="server">CONTACT US</p> <label>Full Name:</label> <asp:TextBox class="FullNameTextBox" runat="server" /> <br /> <br /> <label>Phone Number:</label> <asp:TextBox class="PhoneNumberTextBox" runat="server" /> <br /> <br /> <label>Email:</label> <asp:TextBox class="EmailTextBox" runat="server" /> <br /> <br /> <label>Subject:</label> <asp:TextBox class="SubjectTextBox" runat="server" /> <br /> <br /> <label>Content:</label> <textarea id="ContentTextArea" class="ContentTextArea" rows="2" cols="20"></textarea> <br /> <br /> <asp:Button ID="SendButton" class="SendButton" Text="SEND" runat="server" /> <button id="ClearButton" class="Button2" onclick="ClearButtonClick();">CLEAR</button> <script type="text/javascript"> function ClearButtonClick() { document.getElementById("ContentTextArea").value = ""; return false; }