请问,我在JS中给这个赋值.....
请问,我在JS中给这个赋值,
<input id= "Text2 " type= "text " runat= "server " />
可ID到了客户端成了ctl00_ContentPlaceHolder1_Text2,
document.getElementById( "Text2 ").value=result;要怎么写啊?
ctl00_ContentPlaceHolder1_Text2是随机生成的吗?
------解决方案--------------------document.getElementById( " <%=Text2.ClientID%> ").value
------解决方案--------------------document.getElementById( "Text2 ").value=result;
改为:
document.getElementById( " <%= Text2.ClientID %> ").value=result;
------解决方案-------------------- <script type= "text/jscript " language= "javascript ">
function test()
{
var t;
t=document.getElementById( " <%=TextBox1.ClientID%> ")
alert(t.value)
}
</script>