【发布时间】:2014-05-18 02:19:04
【问题描述】:
我已经编写了第一个下拉列表,以便在第一个列表选择时显示另一个下拉列表。根据第二个下拉列表中的选择,我成功地在同一页面的 iframe 中显示了不同的内容(即我自己网站的不同 html 文件)。一切都没事。 但是,我怀疑iframe对SEO不好,所以我决定用DIV来代替iframe。请原谅我从未接受过php、html等方面的培训。
<iframe id="myIFrame" name="Frame1" width="945" height="460" frameborder="0" ></iframe>
是原始成功代码。
(下面列出了部分但不是全部相关的javascript)
<script type="text/javascript">
function SetIFrame()
{
myFrm = document.getElementById('myIFrame');
myFrm.src = document.mapform.jump.options[document.mapform.jump.selectedIndex].value;
}
</script>
(下面列出了部分但不是全部的相关html代码)
<form name="mapform" method="post">
<select name="jump" id="jump" size="1" style="width: 250px !important; min-width: 250px; max-width: 250px;background-color:#00FF99;" onchange="SetIFrame()" >
<option value="/1.html">1</option>
<option value="/2.html">2</option>
<option value="" selected="selected">hello</option>
</select></form>
我尝试使用
<div id="myIFrame"></div>
或类似的替换
<iframe id="myIFrame" name="Frame1" width="945" height="460" frameborder="0" ></iframe>.
(我真的没有受过训练)但这不起作用。我应该怎么办?提前谢谢你。
【问题讨论】:
标签: javascript jquery html css iframe