请问ASP.NET网页里面嵌入的javascript如何操作控件
比如说改变一个Label的值
<%@ Page Language= "VB " AutoEventWireup= "false " CodeFile= "JSTest.aspx.vb " Inherits= "JSTest " %>
<!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> JSTest </title>
<script language= "javascript " type= "text/javascript ">
function setlabel()
{
document.form1.Label1.value = "123 ";
}
</script>
</head>
<body onload= "setlabel() ">
<form id= "form1 " runat= "server ">
<asp:Label ID= "Label1 " runat= "server " Text= "abc "> </asp:Label>
</form>
</body>
</html>
页面开始后还是显示的abc,在javascript里面如何改变Label1的值呢?
------解决方案--------------------document.getElementById( "Label1 ").innerText = "123 ";
------解决方案-------------------- <script>
<!--
function changeText()
{
document.getElementById( "lblText ").innerHTML= "123 ";
}
//-->
</script>