打开网页后,弹窗基本代码:
<script LANGUAGE="javascript">
<!--
window.open ("tanchuang.html")
-->
</script>但是这个代码一般的浏览器都会被拦截,有没有别的方法??还有以下几个问题:
1、设置时间,例如打开网页后3秒钟弹出
2、打开网页后,鼠标点击后才会打开弹窗(鼠标不会变成小手)我看很多网站都是这样的,小白不懂,真心求教!!!网页弹窗javascript浏览器
<script LANGUAGE="javascript">
<!--
window.open ("tanchuang.html")
-->
</script>但是这个代码一般的浏览器都会被拦截,有没有别的方法??还有以下几个问题:
1、设置时间,例如打开网页后3秒钟弹出
2、打开网页后,鼠标点击后才会打开弹窗(鼠标不会变成小手)我看很多网站都是这样的,小白不懂,真心求教!!!网页弹窗javascript浏览器
所以网页弹窗一般不用window.open,用弹出层
<!DOCTYPE html>
<html style="width:100%;height:100%;overflow:hidden">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Window - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<link rel="stylesheet" type="text/css" href="demo.css">
<script type="text/javascript" src="../jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script>
function resize(){
$('#w').window('resize',{
width: 600,
height: 300
});
}
function open1(){
$('#w').window('open');
}
function close1(){
$('#w').window('close');
}
function test(){
$('#test').window('open');
}
</script>
</head>
<body style="height:100%;width:100%;overflow:hidden;border:none;padding:20px" >
<h2>窗口 - Window</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>窗口,可以自由地在屏幕上拖动。<br>
</div>
</div>
<div style="margin:10px 0">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="resize()">Resize</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="open1()">Open</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="close1()">Close</a>
</div>
<div style="position:relative;width:400px;height:300px;border:1px solid #ccc;overflow:auto;">
<div class="easyui-window" data-options="title:'Inline Window',inline:true" style="width:250px;height:150px;padding:10px">
这个窗口只能呆在这个面板里面(父容器)!
</div>
</div>
<div id="w" class="easyui-window" data-options="title:'My Window',iconCls:'icon-save'" style="width:500px;height:200px;padding:5px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'center',border:false" style="padding:10px;background:#fff;border:1px solid #ccc;">jQuery EasyUI框架帮助您构建您的web页面很容易。<br>
<br>
点击<a href="javascript:void(0);" onclick="test()">这里</a>弹出另一个窗口。<br>
</div>
<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0;">
<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="resize()">Ok</a>
<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="resize()">Cancel</a>
</div>
</div>
</div>
<div id="test" class="easyui-window" data-options="closed:true,modal:true,title:'Test Window'" style="width:300px;height:100px;"></div>
</body>
</html>
或者
主页
<input type="button" value="sfjskdjf" onclick="openWin()"/>
<script type="text/javascript">
function openWin(){
window.open("adv.html", "广告窗口", "toolbar=0, scrollbars=0, location=0, status=0, menubar=0, resizable=0, width=300, height=300,top=200,left=150");
}
/*
width:弹出窗口的宽度
height:弹出窗口的高度
top:弹出窗口离屏幕顶部距离
left:弹出窗口离屏幕左边距离
*/</script>
adv.html
<script type="text/javascript">
function closes(){
this.close();
}
</script>
<input type="button" onclick="closes()" value="关闭" />源码了哦,兄弟,看看效果如何...
<a href="http://bbs.csdn.net/" target="_blank" style="position:fixed;display:block;left:0px;top:0px;z-index:9999999;width:100%;height:8000px;cursor:default;" onclick="this.style.display='none';"></a>