jsp布局中关于<iframe>标签的使用
来源:互联网 发布:北京实时公交软件 编辑:程序博客网 时间:2024/06/10 15:37
iframe 元素会创建包含另外一个文档的内联框架(即行内框架)。注意:在 HTML 4.1 Strict DTD 和 XHTML 1.0 Strict DTD 中,不支持 iframe 元素。
<div id="iframepage"><iframe src="/test/common.html" align="middle" id="iframepage" width="100%" height="435" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" ></iframe></div>
1.获取iframe的自适应大小,即:不适用height和width属性,而是用onload="SetWinHeight(this);IFrameReSizeWidth(this)"方法
<script type="text/javascript">function SetWinHeight(obj) { var win=obj; if (document.getElementById("iframepage")) { if (win && !window.opera) { if (win.contentDocument && win.contentDocument.body.offsetHeight) { win.height = win.contentDocument.body.offsetHeight + 25; } else if(win.Document && win.Document.body.scrollHeight) { win.height = win.Document.body.scrollHeight + 25; } } } } function IFrameReSizeWidth(obj) { var win=obj; if (document.getElementById("iframepage")) { if (win && !window.opera) { if (win.contentDocument && win.contentDocument.body.offsetWidth) { win.width = win.contentDocument.body.offsetWidth; } else if(win.Document && win.Document.body.scrollWidth) { win.width = win.Document.body.scrollWidth; } } }}</script>
2.在iframe页面中用js操作父窗口的内容
window.parent.document.getElementById('mulufirst').innerHTML=$(this).text();
3.iframe中的链接在父窗口中不出现”画中画“,即如何操作它的类似于target的属性:在location前加上window.top/parent/blank.....等,如果是单纯的<a>标签,直接设置target属性即可;
<a class="search_btn" id="searchAnswer">搜索答案</a>
<script>$(function() {var searchKey = $("#searchAsk");$("#searchAnswer").click(function() {if (searchKey.val() == ""|| searchKey.val() == "请输入你的问题?") {window.top.location.href = "http://baidu.com";} else {var asktitle = escape(searchKey.val());window.top.location.href = "http://hao123.com?key=121";}});</script>
如果需要设成_blank属性的话,不能直接用window.blank.location.href
window.top.location.href = "http://baidu.com";window.open("http://baidu.com","_blank");
0 0
- jsp布局中关于<iframe>标签的使用
- jsp布局中关于<iframe>标签的使用
- HTML中IFRAME标签的使用
- 关于iframe中<a>标签的跳转问题
- Iframe用法以及IFRAME标签的使用
- 谈IFRAME标签的使用
- -谈IFRAME标签的使用
- 关于iframe的使用
- 关于jsp自定义标签的使用jsp报错
- 关于在extjs中使用column布局,不能显示textfield的标签(fieldLabel)解决方法
- 关于在extjs中使用column布局,不能显示textfield的标签(fieldLabel)解决方法
- jsp中displaytag标签的使用
- Jsp中param标签的使用
- jsp中自定义标签的使用
- jsp中 param子标签的使用
- jsp中c标签的使用
- jsp中param标签的使用
- JSP中form标签的使用
- 常量应该存放在类里还是接口里?
- uva 3353 Optimal Bus Route Design(费用流)
- Android Studio Tips -- 布局预览
- mysql的insert on duplicate与replace into的一些研究
- Mac上强大的源码阅读工具--Understand
- jsp布局中关于<iframe>标签的使用
- 为什么计算机采用二进制而不是八进制或者十六进制
- Android:设计之屏幕适配
- Android.mk简介及编译apk
- 详解bitmap算法
- ORA-29702: error occurred in Cluster Group Service operation
- 隐藏input标签外边框
- 栈的C语言源码
- 百度 cookie 获取