js数据显示在文本框中(页面加载显示和按钮触动显示)

web代码如下:

<!DOCTYPE html>
<html>
  <head>
    <title>jsTest02.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  </head>
  
  <script>
     function a(){
			var aa = 123456;
			document.getElementById("aaa").value = aa;
		}
		
	 function b(){
			var bb = "你好,在吗?";
			document.getElementById("aaa").value = bb;
		}
		
	 window.onload=a;
</script>

  <body onload="a()">
    <input type="text" name=""  id="aaa"><button onclick="b()">获取js里面的值</button>
  </body>
</html>

 

代码运行效果显示如下:

posted @ 2014-07-25 15:05  岁月淡忘了谁  阅读(1765)  评论(0编辑  收藏  举报