<%@ Page Language="C#" AutoEventWireup="true" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<%--JavaScript—%>
<script type="text/javascript">
function ClientSideScript() { alert('ClientSide!'); }
</script>
<%--Inline Code—%>
<script language="CS" runat="server">
protected void ServerSideScript(object sender, EventArgs e) { Response.Write("alert('ServerSide!');"); }
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" id="Button2" runat="server" value="html_button" onserverclick="ServerSideScript" onclick="ClientSideScript();" />
<asp:button id="Button1" runat="server" Text="aspx_button" OnClick="ServerSideScript" OnClientClick="ClientSideScript()" />
</div>
</form>
</body>
</html>
可比較上方asp元件與html元件的差異..
ServerSide:OnClick
ClientSide:OnClientClick
ServerSide:onserverclick
ClientSide:onclick
沒有留言:
張貼留言