<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函数接受参数并弹出</title>
<style>
body{text-align:center;}
code,input,button{font-family:inherit;}
input{border:1px solid #ccc;padding:3px;}
button{cursor:pointer;}
</style>
<script>
var myFn = function(a,b){
alert(a,value);
alert(b,value)
};
window.onload = function ()
{
var oInput=document.getElementsByTagName("input");
var oBtn=document.getElementsByTagName("button")[0];
oBtn.onclick = function()
{
myFn(oInput[0],oInput[1])
}
};
</script>
</head>
<body>
<p>
<input type="text" value="西安市" />
</p>
<p>
<input type="text" value="changanqu" />
</p>
<p><button>传参</button></p>
</body>
</html>求解答!!!谢谢
慕粉3686312
慕虎1618318
GavinZeng
我是大牛你信么
慕粉3686312
千秋此意
随时随地看视频慕课网APP