js练习 函数接收参数并弹出
没有要点
效果图
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<input type="text" name="" id="1" value="" />
<input type="text" name="" id="2" value="" />
<button type="button" onclick="fu()">传参</button>
<script type="text/javascript">
function fu(){
var x1=document.getElementById('1').value;
var x2=document.getElementById('2').value;
alert(x1);
alert(x2);
}
</script>
</body>
</html>