JS_简单实现页面输入

<!DOCTYPE html>
<html>
<head>
<title>13th_test</title>
<meta charset="gb2312">
</head>

<body>
<h1>这是一个标题</h1>
<p>这是一段文字</p>

<input id="name" type="text">
<input id="job" type="text">
<button type="button" οnclick="fun()">点击这里奇迹出现</button>

<script>
function fun(name, job)
{
	var name = document.getElementById("name").value;
	var job = document.getElementById("job").value;
	window.alert(name+ " is a " + job);
} 
</script>
</body>
</html>

output:


发布了137 篇原创文章 · 获赞 51 · 访问量 28万+

猜你喜欢

转载自blog.csdn.net/Pop_Rain/article/details/74686964