asp.net中js前臺為span或後臺lable,或Literal控制元件賦值
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AdmanageSystem.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></title>
<script type="text/javascript">
function clickMe() {
document.getElementById("lb2").innerText = "Hello world";
document.getElementById("lb3").innerText = "Hello world3";
return;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<%-- 不使用label,使用span或伺服器端label控制元件 <label id="lb1">我是原來的</label>--%>
<asp:label id="lb2" runat="server" Text="我是原來的"></asp:label>
<span id="lb3">我是原來的1</span>
<span id="Span1">我是原來的2</span>
<asp:Literal ID="lab_message" runat="server"/>
<input type="button" onclick="clickMe()" value="我是按鈕,按我一下" />
</div>
</form>
</body>
</html>