如何使用javascript更改文本框值

问题描述:

我的JavaScript函数..

My JavaScript Function..

var e = document.getElementById(id);
		if(e.style.display == 'block' || e.style.display=='')
			document.getElementById("TextBox1").value="show";
		else
			document.getElementById("TextBox1").value="hide";
			}



有任何帮助..



Any Help..

您到底想要什么?但是您的问题标题是答案

what you want exactly ? but with your Question title here is answer

document.getElementById("TextBox1").value="show";


给用作值的字符串加上双引号.


give double Quotes to string which used as value.


您是否有机会在应用程序中使用母版页(ASP.NET)?如果是,请检查这些

ID,ClientID和UniqueID之间的区别 [控制ASP.NET中的Web控件ClientID值 [
Are you using Master pages(ASP.NET) in your application by any chance? If yes then check these

The difference between ID, ClientID and UniqueID[^]
Take Control Of Web Control ClientID Values in ASP.NET[^]


document.getElementById(''< %= TextBox1.ClientID%>'').value =''show'';
document.getElementById(''<%=TextBox1.ClientID%>'').value=''show'';