1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"><head>
3 <meta http-equiv="Content-Type" content="text/html; charset=gbk">
4 <title>函数接收参数并弹出</title>
5 <style type="text/css">
6 body{font:12px/1.5 Tahoma;text-align:center;}
7 code,input,button{font-family:inherit;}
8 input{border:1px solid #ccc;padding:3px;}
9 button{cursor:pointer;}
10 </style>
11 </head>
12 <body>
13 <p><input value="北京市" type="text"></p>
14 <p><input value="朝阳区" type="text"></p>
15 <p><button>传参</button></p>
16 <script type="text/javascript">
17 function point(i1,i2){
18 alert(i1.value);
19 alert(i2.value);
20 }
21
22 window.onload = function(){
23 var button = document.getElementsByTagName("button")[0];
24 var input = document.getElementsByTagName("input");
25 button.onclick = function(){
26 point(input[0],input[1]);
27 };
28 };
29 </script>
30 </body>
31 </html>