zoukankan      html  css  js  c++  java
  • 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>
    

    代码运行效果显示如下:

  • 相关阅读:
    How Many Answers Are Wrong
    Agri-Net —poj1258
    食物链
    A Bug's Life
    畅通工程
    Shortest path of the king
    Alex and Number
    KMP
    快速幂
    0x04
  • 原文地址:https://www.cnblogs.com/henuyuxiang/p/3868093.html
Copyright © 2011-2022 走看看