使用Javascript在iframe中加载html页面

使用Javascript在iframe中加载html页面,javascript,html,iframe,Javascript,Html,Iframe,我试图让每个选项在框架中加载不同的页面 <!DOCTYPE html> <html> <head> <script> function selectCountry() { var mylist=document.getElementById("country"); document.getElementById("frame").src=mylist.options[mylist.selectedIndex].html; } </script

我试图让每个选项在框架中加载不同的页面

<!DOCTYPE html>
<html>
<head>
<script>
function selectCountry()
{
var mylist=document.getElementById("country");
document.getElementById("frame").src=mylist.options[mylist.selectedIndex].html;
}
</script>
</head>
<form action="">
<select id = "country" onchange="selectCountry()">
<option value="america">America</option>
<option value="austria">Austria</option>
<option value="belgium">Belgium</option>
<option value="bosnia">Bosnia and Herzegovina</option>
<option value="croatia">Croatia</option>
<option value="estonia">Estonia</option>
<option value="france">France</option>
<option value="germany">Germany</option>
<option value="greece">Greece</option>
<option value="hungary">Hungary</option>
<option value="italy">Italy</option>
<option value="netherlands">Netherlands</option>
<option value="russia">Russia</option>
<option value="serbia">Serbia</option>
<option value="sweden">Sweden</option>
<option value="switzerland">Switzerland</option>
<option value="uk">UK</option>
</select>
</form>
<iframe id = "frame"></iframe>
</body>
</html>
致:


但是没有快乐。请提供帮助。

您可以这样做

function selectCountry(){
 var mylist=document.getElementById("country");
 document.getElementById("frame").src=mylist.value+'.html';
}

缺少
value

您需要的是.value(),而不是.html()
document.getElementById("frame").src=mylist.options[mylist.selectedIndex] + ".html";
function selectCountry(){
 var mylist=document.getElementById("country");
 document.getElementById("frame").src=mylist.value+'.html';
}
mylist.options[mylist.selectedIndex].value