87,910
社区成员
发帖
与我相关
我的任务
分享
var parentWin = window.opener;
var obj = parentWin.document.getElementById("selectId");
if(true){
pt_dp.options[0].selected = true;
}else{
pt_dp.options[1].selected = true;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<script type="text/javascript">
function selectItem() {
document.getElementById("Select1").selectedIndex = parseInt(document.getElementById("Text1").value);
}
</script>
<body>
<select id="Select1">
<option value="0">0</option>
<option value="1">1</option>
</select>
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="selectItem()" />
</body>
</html>