点击按钮加载iframe再次点击关闭iframe
来源:互联网 发布:金数据是干嘛用的 编辑:程序博客网 时间:2024/05/29 12:10
最初是因为网站里头要嵌入商务通对话窗口
但是如果一开始frame就是打开的,会导致只要有访客进来,就会打开一个对话,导致客服要处理太多对话了。
所以处理方法是打开的时候只有点击按钮才将frame的内容加载进来append,关闭的时候将frame这个div的内容remove掉
而通过改变frame src的方法是不行的,离开的时候置空会有个提示是否离开的提示框,与实际情况不符合
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
<script src="./jquery.js"></script>
<script>
function openme(){
var num = window.frames.length;
//window.frames[0].location.href = "http://www.sina.com.cn";
//document.getElementById('swtframe').src = "http://bwt.zoossoft.cn:88/LR/Chatpre.aspx?id=BWT74388660&lng=cn&e=zixunbaobao";
var inserthtml = '<iframe id="swtframe" src="http://pet.zoosnet.net/LR/Chatpre.aspx?id=PET80862092&lng=cn&e=zixunbaobao" name="swtframe" width="100%" height="100%" srcoll="yes" ></iframe>';
$("#swtcenter").append(inserthtml);
}
function leaveme(){
//window.frames[0].document.onbeforeunload = "";
//document.getElementById('swtframe').src = "";
$("#swtcenter :first-child").remove();
}
</script>
</head>
<body>
<div id="swtcenter" style="width:800px;height:600px;position:fixed;z-index:999;top:50%;left:50%;margin-left:-400px;margin-top:-300px;"></div>
<div id="zixunbaobao" style="position:fixed;z-index:999;top:0px;left:0px;width:60px;height:30px;" onclick="openme()">打开我</div>
<div id="zixunbaobao" style="position:fixed;z-index:999;left:80px;top:0px;width:60px;height:30px;" onclick="leaveme()">关闭我</div>
</body>
</html>
- 点击按钮加载iframe再次点击关闭iframe
- 调用iframe中的按钮点击
- iframe异步加载(点击左边菜单加载右边内容)
- 关于点击按钮弹出iframe窗口的前端代码
- # 点击左边按钮,页面出现在右边(iframe标签) #
- 点击打印按钮,开始渲染iframe然后执行打印事件
- 点击iframe 中某页面的一个按钮实现跳转到iframe外面的窗体里面
- 点击按钮button触发修改div的iframe内容 (修改iframe的src内容)
- 在iframe里点击超链接
- iframe监听鼠标点击事件
- iframe监听鼠标点击事件
- 给iframe添加点击事件
- iframe监听鼠标点击事件
- 点击按钮变成灰色不可再次点击
- 动态加载iframe和关闭
- 点击按钮 加载更多
- 点击链接,切换不同的iframe
- 点击隐藏div存在iframe无效
- WPF——TextBox 滚动条与StackPanel
- DatePickerDialog\TimePickerDialog日期时间选择器
- BING算法——思路整理(目标检测算法)
- ubuntu常用命令
- CDH(Cloudera)与hadoop(Apache)对比
- 点击按钮加载iframe再次点击关闭iframe
- 学生-课程数据库
- Fresco和Glide同时用的时候需要注意
- linux快速安装lamp的方法
- YUM 本地源的搭建
- OAuth协议授权
- 浅谈web前端开发
- AIX 分页替换技术入门
- iOS 引导页