日期:2014-05-16 浏览次数:20422 次
<!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>
<script language="javascript">
var defaultValue;
window.onload = function() {
defaultValue = {
"aa" : document.getElementsByName('aa')[0].value,
"bb" : document.getElementsByName('bb')[0].value
};
console.log(defaultValue);
}
function resetA(){
document.getElementsByName('aa')[0].selectedIndex = document.getElementsByName('aa')[0].value;
}
function reset1(){
document.getElementsByName('bb')[0].selectedIndex = defaultValue["bb"];
}
</script>
</head>
<body>
<div id="div1"></div>
<select name="aa">
<option value="">-选择大版块-</option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
<select name="bb">
<option value="">-选择大版块-</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<div onclick="resetA()">a</div>
<div onclick="reset1()">1</div>
</body>
</html>