我正在尝试做这样的事情:
我希望能够根据下拉列表中选择的选项动态更改 iframe。
我到目前为止的代码是这样的:
<html>
<head>
<script>
function hidem() {
document.getElementById('Select').style.display = "none";
document.getElementById('test1').style.display = "none";
document.getElementById('test2').style.display = "none";
}
function changeIt(divid) {
hidem();
document.getElementById(divid).style.display = "block";
}
</script>
</head>
<table border="0">
<tr>
<td>
<select id="Manage" onChange="changeIt(this.value)">
<option value="Select">Select A Management Window</option>
<option value="test1">Google</option>
<option value="test2">Yahoo</option>
</select>
</td>
<td>
<div id="Select">
<h2>Information:</h2>
This is a management console
</div>
<div id="test1" style="display:none">
<h2>Google:</h2>
<iframe src="http://www.google.com" width="100%" height="100%"></iframe>
</div>
<div id="test2" style="display:none">
<h2>Yahoo:</h2>
<iframe src="http://www.yahoo.com" width="100%" height="100%"></iframe>
</div>
</td>
</tr>
</html>
但它似乎并没有按照我的意图工作。有人能帮我解决这个问题吗?
谢谢你,
戴夫