举个栗子:
<html>
<HEAD>
<script type="text/javascript" language="Javascript1.1"> var text="aaa"; </script>
</HEAD>
<BODY> <form id="form1" method="post" > <TABLE border="1" style="560"> <TR>
<TD nowrap class="tdLeft">信息来源</TD> <TD> <input type="text" size="30" value=""> </TD>
</TR> </TABLE>
</form>
</BODY>
</html>
怎么将变量text的值赋给文本域<input type="text" size="30" value="">
解决方案:
<html>
<HEAD>
<script type="text/javascript"> var text="aaa"; document.getElementById("text1").value = text; </script>
</HEAD>
<BODY> <form id="form1" method="post" > <TABLE border="1" style="560"> <TR>
<TD nowrap class="tdLeft">信息来源</TD> <TD> <input type="text" size="30" value="" id="text1"> </TD>
</TR> </TABLE>
</form>
</BODY> </html>