我有很多iframe src链接,我希望选择属性显示它。我就是这样做的——
组件.html
<select name="numberOfChildren" class="selectBox">
<option value="<iframe
src="http://10.0.0.4:5601/app/kibana#/dashboard?embed=true&_g
width="1200">">Graph one
<option value="<iframe
src="http://10.0.0.4:5601/app/kibana#/dashboard/79ffd6e0-faa0-
11e6-
947f-177f697178b8?embed=true&_g width="1200">">graph two
</select>
我得到的错误是:
Unexpected closing tag "select". It may happen when the tag has
already been closed by another tag. For more info see
https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-
implied-end-tags ("
[ERROR ->]</select>
请帮助我显示一个选择属性,并将值作为 iframe 链接。
你没有正确关闭option
标签,使用此代码
<select name="numberOfChildren" class="selectBox">
<option value="<iframe
src="http://10.0.0.4:5601/app/kibana#/dashboard?embed=true&_g
width="1200">">Graph one</option>
<option value="<iframe
src="http://10.0.0.4:5601/app/kibana#/dashboard/79ffd6e0-faa0-
11e6-
947f-177f697178b8?embed=true&_g width="1200">">graph two
</option>
</select>
更新
您添加 iFrame 的方式是错误的,而不是作为值传递,您需要调用函数并像这样更改该 iFrame 的 srs
<select name="numberOfChildren" class="selectBox">
<option value="getIframeValue('http://10.0.0.4:5601/app/kibana#/dashboard?embed=true&_gwidth=1200')">Graph one</option>
<option value="getIframeValue('http://10.0.0.4:5601/app/kibana#/dashboard/79ffd6e0-faa0-11e6-947f-177f697178b8?embed=true&_g width=1200')">Graph Two</option>
</select>
<iframe id="MyFrame1" name="MyFrame1" style="width: 1040px; height: 682px" src="Default.aspx"></iframe>
getIframeValue(src) {
window.document.getElementById("MyFrame1").src = src
}