62,046
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="CaiPiao.WebForm2" %>
<!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 btnClick() {
document.getElementById("txt").id = "tt";
alert(document.getElementById("tt").value);//测试一下是否能够找到新修改ID之后的Textbox值。
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="txt" type="text" />
<input type=button value="修改文本框ID" onclick="btnClick()" />
</div>
</form>
</body>
</html>
document.getElementById("aaa").id="ID";