前段时间帮同事解决问题,iframe不能改变src 动态加载. 研究发现 火狐对iframe的支持度最高 iframe动态加载
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iframe动态加载</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label for="caidanyi"></label>
<select name="caidanyi" id="caidanyi" οnchange="demo();">
<option value="http://www.ifeng.com" >第一期</option>
<option value="http://www.baidu.com" >第二期</option>
<option value="http://www.xunlei.com">第三期</option>
</select>
</form>
<iframe name="frame1" id="frame1" src="http://www.ifeng.com" height="768" width="1024"></iframe>
<script type="text/javascript">
function demo(){
//第一种方法 使用Window。open
// window.open(document.getElementById('caidanyi').value,'frame1');
//第二种方法:document.getElementById('frame1').src
document.getElementById('frame1').src=document.getElementById('caidanyi').value;
}
</script>
</body>
</html>