<!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>
<style>
#div1 {
width: 100px;
height: 100px;
background: red;
position: absolute;
}
#div2 {
width: 100px;
height: 100px;
background: yellow;
position: absolute;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
window.onload=function()
{
var oBtn=document.getElementById('btn1');
var oText=document.getElementById('text1');
var oSelect=document.getElementById('select1');
oBtn.onclick=function(){
//alert(oText.value);
alert(oSelect.value);
}
}
</script>
</head>
<body>
<input id="text1" type="text"/>
<select id="select1">
<option id="select1">
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="杭州">杭州</option>
</option>
</select>
<input id="btn1" type="button" value="按钮"/>
</body>
</html>
JavaScript获取HTML.value
猜你喜欢
转载自blog.csdn.net/qq_37995109/article/details/85252709
今日推荐
周排行