日期:2014-05-16  浏览次数:20455 次

如何按按钮后TEXTBOX出现文字?分不多先谢了
我有个表单如下:
<form name="myform">
   
  Show:<input name="tt" type="text" size=40><br>
  <input type="submit" value="Submit">
   
  </form>

如何实现按了这个SUBMIT按钮,那个textbox里显示文字比如"message hello"?

还有,是否有办法,本身TEXTBOX和BUTTON是隐藏的,旁边有个连接,按了连接才TEXTBOX出现?

谢谢啦

------解决方案--------------------
<form name="myform">

Show:<input name="tt" id="tt" type="text" size=40><br>
<input type="submit" value="Submit">
<script type='javascript/text'>
function showMessage(){
document.getElementById("tt").value='你要显示的信息';
}
document.getElementById("tt").onclick=showMessage;
</script>

</form>


------解决方案--------------------
第二个:
HTML code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script type="text/javascript">
 function Test()
 {
   document.getElementById("tt").value="message hello";
 }
 function show()
 {
   document.getElementById("tt").style.display="";
   document.getElementById("btn").style.display="";
 }
</script>
</head>
<body>
<form name="myform" onsubmit="Test();" action="http://www.baidu.com" target="_blank">
  Show:<input name="tt" id="tt" type="text" size=40 style="display:none"><br>
  <input type="submit" value="Submit" style="display:none" id="btn">
  <a href="#" onclick="show()">显示</a>
</form>
</body>
</html>