HTML弹出窗口
1.最简单的
<script type="text/javascript">
<!--
window.open("http://cn.bing.com");
window.open("../../page.html");
window.open("some.html");
window.open("some.html","some_tag","height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
-->
</script>
2.使用函数
<script type="text/javascript">
function open_window(){
window.open("some.html");
}
</script>
调用:
1.<body onload="open_window()"> //打开网页弹出
2.<body onunload="open_window()"> //关闭网页弹出
3.<a href="#" onclick="open_window()"> //点击链接弹出
3.让弹出的窗口自动关闭
<script type="text/javascript>
function close_itself(){
setTimeout("self.close()", 10000); //10秒后关闭
}
</script>
4.在当前窗口内弹出
<script type="text/javascript">
OpenWindow=window.open("", "some_tag", "height=250,width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>some_example</TITLE>");
OpenWindow.document.write("<BODY BGCOLOR=#ffffff>");
OpenWindow.document.write("<h1>Hello!</h1>");
OpenWindow.document.write("New window opened!");
OpenWindow.document.write("</BODY>");
OpenWindow.document.write("</HTML>");
OpenWindow.document.close();
</script>
5.弹出窗口之Cookie控制
<script type="text/javascript">
function open_window(){
window.open("some.html","some_tag","width=200,height=200");
}
function get_cookie(Name){
var search = Name + "=";
var returnvalue = "";
if (documents.cookie.length > 0) {
offset = documents.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = documents.cookie.indexOf(";", offset);
if (end == -1){
end = documents.cookie.length;
}
returnvalue=(documents.cookie.substring(offset, end));
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')==''){
open_window();
documents.cookie="popped=yes";
}
}
</script>
6.弹出窗口渐变大
1. 居中弹出窗口, 并逐步扩大
<script type="text/javascript">
if (navigator.appName=="Microsoft Internet Explorer") {//最大化窗口
self.moveTo(-5,-5);
self.resizeTo(screen.availWidth +8,screen.availHeight+8) //这个脚本定义的宽度其实比原窗口还要大那么一点.
}
var w=h=200;
x=(screen.width-w)/2;
y=(screen.height-h)/2;
var n=open('','newWin','width='+w+',height='+h+',left='+x+',right='+x+',top='+y+',bottom='+y);
n.document.write('
<script>
document.write("temp"); /* 临时内容, 去掉出错 */
document.body.innerHTML=""; /* 清空页面内容 */
document.onclick=function() /* 单击关闭窗口 */
</script>');
n.document.write('<h2>test moving window</h2>');
n.focus();
var timer=setInterval('fMovingWin()',1);
function fMovingWin(){
if (n.closed||(w>=screen.width+8&&h>=screen.height+8)) {
clearInterval(timer);
return;
}
try{
if(w<=screen.width+8)w+=2;
if(h<=screen.height+8)h+=2;
n.resizeTo(w, h)
x=(screen.width-w)/2;
y=(screen.height-h)/2;
n.moveTo(x,y)
} catch(e) {} //shawl.qiu script
}
</script>
end
HTML弹出窗口的更多相关文章
- jQuery弹出窗口浏览图片
效果预览:http://keleyi.com/keleyi/phtml/jqtexiao/3.htm HTML文件代码: <!DOCTYPE HTML> <html> < ...
- EasyUI弹出窗口实例
效果体验:http://hovertree.com/texiao/jeasyui/1.htm 源代码下载:HovertreeJEasyUI HTML文件代码: <!DOCTYPE html> ...
- 让IE8在win7下面能显示使用window.showmodaldialog弹出窗口的地址状态栏
问题来源:最近又要对老的系统进行改善,由于用到了window.showmodaldialog这个方法弹出窗口,比如从主界面弹出新增或者修改窗口,如下图所示,显示没有地址栏,进行代码修改还要找到相应的文 ...
- java selenium (十二) 操作弹出窗口
selenium 中如何处理弹出窗口 阅读目录 原理 在代码里, 通过 Set<String> allWindowsId = driver.getWindowHandles ...
- JSP弹出窗口和模式对话框
本文转载于其它blog,在此向本文原创者,致意! JSP 弹出窗口 一.window.open() 基础知识 1.window.open()支持环境: JavaScript1.0+ ...
- [转]js来弹出窗口的详细说明
1.警告对话框 <script> alert("警告文字") </script> 2.确认对话框 <script> confirm(" ...
- OAF_开发系列08_实现OAF通过Popup参数式弹出窗口(案例)
20150711 Created By BaoXinjian
- 【CefSharp】 禁用右键菜单 与 控制弹出窗口的方式(限版本39.0.0.1)
这周没什么时间,一开始就在忙一些CefSharp的事情,Win10的研究就放了下来,CefSharp的资料挺少的,但好在是开源的,可以我们便宜的折腾.因为两个的内容都不多,我就合成一篇文章啦. 这还里 ...
- jquery-通过js编写弹出窗口
本文转载 本文主要是通过js动态控制div的高度,css控制浮动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// ...
- 在HTML网页中设置弹出窗口的办法
[1.最基本的弹出窗口代码] 其实代码非常简单: <SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.h ...
随机推荐
- Part 14 ng hide and ng show in AngularJS
ng-hide and ng-show directives are used to control the visibility of the HTML elements. Let us under ...
- 放弃SCOPE_Identity,使用OUTPUT代替
最近项目中使用了SCOPE_IDENTITY()来获取新增数据的自动递增ID号. 在运行过程中会不时的发生无法通过SCOPE_IDENTITY()来获取ID号的情况. 尝试着测试又发现不了问题. 今天 ...
- windows server 2008 防火墙配置
防火墙的配置主要是过滤用户是否能够访问服务器,哪些用户能够访问,哪些用户不能访问.类似于交换机上的acl(访问控制列表) 在windows服务器上有入站规则以及出站规则,那我们首先得了解一下什么是入站 ...
- asp.net ajax 调用错误解决
ajax调用aspx页面出现如下错误 前台源代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...
- Ubuntu14.04 Chromium 编译
1.下载depot_tools: 首先安装 git-core: sudo apt-get install git-core 执行命令: git clone https://chromium.googl ...
- CCNA长语
思科认证网络支持工程师(Cisco Certified Network Associate_CCNA) 专业英文词汇大全 10BaseT-----原始IEEE802.3标准的一部分,1OBaseT是1 ...
- 【学习笔记】【C语言】算术运算
C语言一共有34种运算符,包括了常见的加减乘除运算 1. 加法运算+ 除开能做加法运算,还能表示正号:+5.+90 2. 减法运算- 除开能做减法运算,还能表示符号:-10.-29 3. 乘法运算* ...
- Bring up a website by wordpress
WORDPRESS WordPress is web software you can use to create a beautiful website or blog, which is both ...
- 全排列算法(字典序法、SJT Algorithm 、Heap's Algorithm)
一.字典序法 1) 从序列P的右端开始向左扫描,直至找到第一个比其右边数字小的数字,即. 2) 从右边找出所有比大的数中最小的数字,即. 3) 交换与. 4) 将右边的序列翻转,即可得到字典序的下一个 ...
- Windows Phone 8 蓝牙编程
蓝牙是手机的近距离无限传输的技术,在之前的Windows Phone 7系统手机里面仅支持蓝牙耳机功能,并不支持蓝牙文件信息传输,那么在Windows Phone 8手机里面将全面支持蓝牙技术,并且提 ...