js实现网页右下角弹出窗口代码

合集下载

Javascript弹窗代码大全(收集)

Javascript弹窗代码大全(收集)

弹窗代码大全(收集)以下包括强制弹窗 24小时IP弹窗延时弹窗退弹等我们使用cookie来控制一下就可以了。

首先,将如下代码加入主页面html的<head>区:<script>function openwin(){window.open(”page.html”,”",”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.lengthend = documents.cookie.indexof(”;”, offset);if (end == -1)end = documents.cookie.length;returnvalue=”/unescape(documents.cookie.substring(offset,end))”}}return returnvalue;}function loadpopup(){if (get_cookie(’popped’)==”){openwin()documents.cookie=”popped=yes”}}</script>然后,用<body onload=”loadpopup()”>(注意不是openwin而是loadpop啊!)替换主页面中原有的<body>这一句即可。

你可以试着刷新一下这个页面或重新进入该页面,窗口再也不会弹出了。

真正的pop-only-once!写到这里弹出窗口的制作和应用技巧基本上算是完成了,俺也累坏了,一口气说了这么多,希望对正在制作网页的朋友有所帮助俺就非常欣慰了。

网页弹出窗口代码汇总

网页弹出窗口代码汇总

网页弹出窗口代码汇总网页弹出窗口代码汇总【1、最基本的弹出窗口代码】其实代码非常简单:script __E=“javascript"!--window.open ("/szqpz/")--/script因为着是一段javascripts代码,所以它们应该放在script __E="javascript"标签和/script之间。

!-- 和--是对一些版本低的浏览器起作用,在这些老浏览器中不会将标签中的代码作为文本显示出来。

要养成这个好习惯啊。

window.open ("/szqpz/") 用于控制弹出新的窗口/szqpz/,如果/szqpz/不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。

用单引号和双引号都可以,只是不要混用。

这一段代码可以加入HTML的任意位置,head和/head之间可以,body间/body也可以,越前越早执行,尤其是页面代码长,又想使页面早点弹出就尽量往前放。

【2、经过设置后的弹出窗口】下面再说一说弹出窗口的设置。

只要再往上面的代码中加一点东西就可以了。

我们来定制这个弹出的窗口的外观,尺寸大小,弹出的位置以适应该页面的具体情况。

script __E="javascript"!--window.open ("/jrsy/", "newwindow","height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no") //写成一行--网页弹出窗口代码汇总,希望能帮到想学习网页弹出窗口的人。

参数解释:script __E="javascript" js脚本开始;window.open 弹出新窗口的命令;"/jrsy/" 弹出窗口的文件名;"newwindow" 弹出窗口的名字(不是文件名),非必须,可用空""代替;height=100 窗口高度;width=400 窗口宽度;top=0 窗口距离屏幕上方的象素值;left=0 窗口距离屏幕左侧的象素值;toolbar=no 是否显示工具栏,yes为显示;menubar,scrollbars 表示菜单栏和滚动栏。

[JS]九种网页弹窗代码

[JS]九种网页弹窗代码

[JS]九种⽹页弹窗代码【1、最基本的弹出窗⼝代码】其实代码⾮常简单:<SCRIPT LANGUAGE="javascript"><!--window.open ("page.html")--></SCRIPT>因为着是⼀段javascripts代码,所以它们应该放在<SCRIPT LANGUAGE="javascript">标签和</script>之间。

<!-- 和 -->是对⼀些版本低的浏览器起作⽤,在这些⽼浏览器中不会将标签中的代码作为⽂本显⽰出来。

要养成这个好习惯啊。

window.open (page.html) ⽤于控制弹出新的窗⼝page.html,如果page.html不与主窗⼝在同⼀路径下,前⾯应写明路径,绝对路径(http://)和相对路径(../)均可。

⽤单引号和双引号都可以,只是不要混⽤。

这⼀段代码可以加⼊HTML的任意位置,<head>和</head>之间可以,<body>间</body>也可以,越前越早执⾏,尤其是页⾯代码长,⼜想使页⾯早点弹出就尽量往前放。

【2、经过设置后的弹出窗⼝】下⾯再说⼀说弹出窗⼝的设置。

只要再往上⾯的代码中加⼀点东西就可以了。

我们来定制这个弹出的窗⼝的外观,尺⼨⼤⼩,弹出的位置以适应该页⾯的具体情况。

<SCRIPT LANGUAGE="javascript"><!--window.open ("page.html, newwindow, height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no")file://写成⼀⾏--></SCRIPT>参数解释:<SCRIPT LANGUAGE="javascript"> js脚本开始;window.open 弹出新窗⼝的命令;page.html 弹出窗⼝的⽂件名;newwindow 弹出窗⼝的名字(不是⽂件名),⾮必须,可⽤空代替;height=100 窗⼝⾼度;width=400 窗⼝宽度;top=0 窗⼝距离屏幕上⽅的象素值;left=0 窗⼝距离屏幕左侧的象素值;toolbar=no 是否显⽰⼯具栏,yes为显⽰;menubar,scrollbars 表⽰菜单栏和滚动栏。

Js+DVML很酷漂亮实用的右键弹出菜单

Js+DVML很酷漂亮实用的右键弹出菜单

Js+DVML很酷漂亮实⽤的右键弹出菜单全选注:引⼊外部Js需再刷新⼀下页⾯才能执⾏]<title>Js+DVML:很酷实⽤的右键弹出菜单</title><style> v\:*{behavior:url(#default#VML);}.menulist{position:static;PADDING-TOP:6;LETTER-SPACING:8;HEIGHT:20;TEXT-ALIGN:center;margin-bottom:-2} </style><script> //作者:风云舞 varmenutime1=null,showobjs1=null //menutime1=循环计时器调⽤变量,showobjs1=绑定菜单,定时器过程执⾏时调⽤ functiondocument.onmouseup(){if(event.button==2)menushow(menu2,60,10)}functionmenushow(showobjs,showwid,showsudu){ //右键菜单展开函数 //函数说明:menushow(菜单id,项平均宽度,伸展速度)if(menutime1!=null){clearInterval(menutime1);menutime1=null}showobjs.style.left=event.x;showobjs.style.top=event.y;showobjs1=showobjs.all.tags("roundrect");varshowlens=showobjs1.lengthfor(i=0;i<showlens;i++){showobjs1[i].style.width=0;showobjs1[i].style.visibility="hidden"}showobjs.style.display=""menutime1=setInterval("for(i=0;i<"+showlens+";i++){showobjs1[i].style.visibility='';if(showobjs1[i].offsetWidth<"+showwid+"){showobjs1[i].style.width=showobjs1[i].offsetWidth+"+showsudu+";break;}else{if(i=="+(showlens-1)+"){clearInterval(menutime1。

弹出窗口代码大全

弹出窗口代码大全

弹出窗⼝代码⼤全经常上⽹的朋友可能会到过这样⼀些⽹站,⼀进⼊⾸页⽴刻会弹出⼀个窗⼝,或者按⼀个连接或按钮弹出,通常在这个窗⼝⾥会显⽰⼀些注意事项、版权信息、警告、欢迎光顾之类的话或者作者想要特别提⽰的信息。

其实制作这样的页⾯效果⾮常的容易,只要往该页⾯的HTML⾥加⼊⼏段Javascript代码即可实现。

下⾯俺就带您剖析它的奥秘。

xx【1、最基本的弹出窗⼝代码】其实代码⾮常简单:<SCRIPT LANGUAGE="javascript"><!--window.open ('page.html')--></SCRIPT>xx因为这是⼀段javascripts代码,所以它们应该放在<SCRIPT LANGUAGE="javascript">标签和</script>之间。

<!-- 和 -->是对⼀些版本低的浏览器起作⽤,在这些⽼浏览器中不会将标签中的代码作为⽂本显⽰出来。

要养成这个好习惯皒x?xx⽤单引号和双引号都可以,只是不要混⽤。

xx这⼀段代码可以加⼊HTML的任意位置,<head>和</head>之间可以,<body>间</body>也可以,越前越早执⾏,尤其是页⾯代码长,⼜想使页⾯早点弹出就尽量往前放。

xx【2、经过设置后的弹出窗⼝】xx下⾯再说⼀说弹出窗⼝的设置。

只要再往上⾯的代码中加⼀点东西就可以了。

我们来定制这个弹出的窗⼝的外观,尺⼨⼤⼩,弹出的位置以适应该页⾯的具体情况。

<SCRIPT LANGUAGE="javascript"><!--window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')//写成⼀⾏--></SCRIPT>xx参数解释:<SCRIPT LANGUAGE="javascript"> js脚本开始;window.open 弹出新窗⼝的命令;'page.html' 弹出窗⼝的⽂件名;'newwindow' 弹出窗⼝的名字(不是⽂件名),⾮必须,可⽤空''代替;height=100 窗⼝⾼度;width=400 窗⼝宽度;top=0 窗⼝距离屏幕上⽅的象素值;left=0 窗⼝距离屏幕左侧的象素值;toolbar=no 是否显⽰⼯具栏,yes为显⽰;menubar,scrollbars 表⽰菜单栏和滚动栏。

自制网页右下角浮动窗口

自制网页右下角浮动窗口

自制网页右下角浮动窗口效果图如下图所示:一.在需要添加浮动窗口的页面的head中引入css代码,代码如下:<!-- 浮动窗口样式css begin --><style type="text/css">#msg_win{border:1px solid#A67901;background:#EAEAEA;width:240px;position:absolute;right:0;font-size:1 2px;font-family:Arial;margin:0px;display:none;overflow:hidden;z-index:99;} #msg_win.icos{position:absolute;top:2px;*top:0px;right:2px;z-index:9;}.icos a{float:left;color:#833B02;margin:1px;text-align:center;font-weight:bold; width:14px;height:22px;line-height:22px;padding:1px;text-decoration:none;font-f amily:webdings;}.icos a:hover{color:#fff;}#msg_title{background:#BBDEF6;border-bottom:1px solid#A67901;border-top:1px solid #FFF;border-left:1px solid#FFF;color:#000;height:25px;line-height:25px;text-indent:5px;}#msg_content{margin:5px;margin-right:0;width:230px;height:126px;overflo w:hidden;}</style><!-- 浮动窗口样式css end -->二.在需要添加浮动窗口的页面的head中添加js代码,代码如下:window.onload=function(){setTimeout('refresh10()',1000*60*10) ;}function refresh10(){window.location.reload();}三.在需要添加浮动窗口的页面的尾部添加js代码,代码如下:<!-- 浮动窗口js,必须要放置到最后begin--><script language="javascript">var Message={set: function() {//最小化与恢复状态切换var set=this.minbtn.status == 1?[0,1,'block',this.char[0],'最小化']:[1,0,'none',this.char[1],'展开'];this.minbtn.status=set[0];this.win.style.borderBottomWidth=set[1];this.content.style.display =set[2];this.minbtn.innerHTML =set[3]this.minbtn.title = set[4];this.win.style.top = this.getY().top;},close: function() {//关闭this.win.style.display = 'none';window.onscroll = null;},setOpacity: function(x) {//设置透明度var v = x >= 100 ? '': 'Alpha(opacity=' + x + ')';this.win.style.visibility = x<=0?'hidden':'visible';//IE有绝对或相对定位内容不随父透明度变化的bugthis.win.style.filter = v;this.win.style.opacity = x / 100;},show: function() {//渐显clearInterval(this.timer2);var me = this,fx = this.fx(0, 100, 0.1),t = 0;this.timer2 = setInterval(function() {t = fx();me.setOpacity(t[0]);if (t[1] == 0) {clearInterval(me.timer2) }},10);},fx: function(a, b, c) {//缓冲计算var cMath = Math[(a - b) > 0 ? "floor": "ceil"],c = c || 0.1;return function() {return [a += cMath((b - a) * c), a - b]}},getY: function() {//计算移动坐标var d = document,b = document.body, e = document.documentElement;var s = Math.max(b.scrollTop, e.scrollTop);var h =/BackCompat/i.test(patMode)?b.clientHeight:e.clientHeight;var h2 = this.win.offsetHeight;return {foot: s + h + h2 + 2+'px',top: s + h - h2 - 2+'px'}},moveTo: function(y) {//移动动画clearInterval(this.timer);var me = this,a = parseInt(this.win.style.top)||0;var fx = this.fx(a, parseInt(y));var t = 0 ;this.timer = setInterval(function() {t = fx();me.win.style.top = t[0]+'px';if (t[1] == 0) {clearInterval(me.timer);me.bind();}},10);},bind:function (){//绑定窗口滚动条与大小变化事件var me=this,st,rt;window.onscroll = function() {clearTimeout(st);clearTimeout(me.timer2);me.setOpacity(0);st = setTimeout(function() {me.win.style.top = me.getY().top;me.show();},600);};window.onresize = function (){clearTimeout(rt);rt = setTimeout(function() {me.win.style.top = me.getY().top},100);}},init: function() {//创建HTMLfunction $(id) {return document.getElementById(id)};this.win=$('msg_win');var set={minbtn: 'msg_min',closebtn: 'msg_close',title:'msg_title',content: 'msg_content'};for (var Id in set) {this[Id] = $(set[Id])};var me = this;this.minbtn.onclick = function() {me.set();this.blur()};this.closebtn.onclick = function() {me.close()};this.char=erAgent.toLowerCase().indexOf('firefox')+1?['_','::','×']:['0','2','r'];//FF不支持webdings字体this.minbtn.innerHTML=this.char[0];this.closebtn.innerHTML=this.char[2];setTimeout(function() {//初始化最先位置me.win.style.display = 'block';me.win.style.top = me.getY().foot;me.moveTo(me.getY().top);},0);return this;}};Message.init();</script><!-- 浮动窗口js end-->四.Body部分添加浮动床的代码,代码如下:<!-- 浮动窗口html代码begin --><hr><div id="msg_win"style="display:block;top:490px;visibility:visible;opacity:1;"> <div class="icos"><a id="msg_min"title="最小化"href="javascript:void0">_</a><a id="msg_close"title="关闭"href="javascript:void 0">×</a></div><div id="msg_title">设备运行情况--></div><div id="msg_content"style="overflow:auto;height:150px;width:100%;white-s pace:nowrap"><s:property value="devRun"escape="false"/>(自己要显示的内容)</div></div><!-- 浮动窗口html代码end -->。

网站右下角悬浮窗口js代码 兼容各浏览器

网站右下角悬浮窗口js代码 兼容各浏览器

网站右下角悬浮窗口js代码兼容各浏览器兼容ie5、ie6、ie7 、ie8 、ff、gg等浏览器,在不同分辨率下都会显示在有下角,效果可见衣超网<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><body><div class="liuyanCard" id="dyCard"><div class="topDiv">&nbsp;</div><div class="centerDiv"><div class="nrCard"><ul><li>font>${wi[0].mwebname}</font>为您提供广告投放、友情链接互换、企业加盟、服装产品销售、商机发布、招聘联盟等服务,如有需求请联系我们!</li></ul><dl><dd><a target="_blank"href="/msgrd?v=3&uin=1582672370&site=qq&menu=yes"><i mg border="0" src="/pa?p=2:1582672370:45" alt="点击这里给我发消息" title="点击这里给我发消息">客服[1582672370]</a></dd></dl><dl><dd><a target="_blank"href="/msgrd?v=3&uin=2390229430&site=qq&menu=yes"><i mg border="0" src="/pa?p=2:2390229430:45" alt="点击这里给我发消息" title="点击这里给我发消息">客服[2390229430]</a></dd></dl><dl><dt class="telDt">&nbsp;</dt><dd>客服</dd><dd& gt;${wi[0].mnumber}</dd></dl></div></div><div class="bottomDiv">&nbsp;</div></div></body></html><script LANGUAGE="JavaScript">var img=document.getElementById("dyCard");var xPos = document.body.offsetWidth-2;var yPos = document.body.clientHeight-img.offsetHeight;img.style.right= 0;img.style.top = yPos;var step = 1;var delay = 30;var width,height,Hoffset,Woffset;var y = 1;var x = 1;var interval;img.visibility = "visible";function changePos(){var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;yMenuFrom = parseInt(document.getElementById("dyCard").style.top, 10);yMenuTo = document.documentElement.scrollTop+document.body.scrollTop+ yPos; //距页面顶部的距离timeoutNextCheck = 10;if ( yMenuFrom != yMenuTo ) {yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 ); if ( yMenuTo < yMenuFrom )yOffset = -yOffset;document.getElementById("dyCard").style.top = parseInt (document.getElementById("dyCard").style.top, 10) + yOffset+"px";timeoutNextCheck = 10;}}function start(){interval = setInterval('changePos()', delay);}function pause_resume(){clearInterval(interval);}start();</script>。

javascript弹出和关闭网页窗口代码大全

javascript弹出和关闭网页窗口代码大全

javascript弹出和关闭网页窗口代码大全javascript弹出和关闭网页窗口代码大全//关闭,父窗口和子窗口都不弹出对话框,直接关闭this.Response.Write("<script> ");this.Response.Write("{top.opener =null;top.close();}");this.Response.Write("</script> ");//关闭,父窗口弹出对话框,子窗口直接关闭this.Response.Write("<script language=javascript> window.close();</script> ");//弹出窗口刷新当前页面width=200 height=200菜单。

菜单栏,工具条,地址栏,状态栏全没有this.Response.Write("<script language=javascript> window.open('rows.aspx','newwindow','width=200,height=200') </script> ");//弹出窗口刷新当前页面this.Response.Write("<script language=javascript> window.open('rows.aspx')</script> ");this.Response.Write("<script>window.open('WebForm2.aspx','_blank');</script> ");//弹出提示窗口跳到webform2.aspx页(在一个IE窗口中)this.Response.Write(" <script language=javascript> alert('注册成功');window.window.location.href='WebForm2.aspx';</script> ");//关闭当前子窗口,刷新父窗口this.Response.Write("<script>window.opener.location.href=window.opener.location.href;wind ow.close();</script> ");this.Response.Write("<script>window.opener.location.replace(window.opener.document.referr er);window.close();</script> ");//子窗口刷新父窗口this.Response.Write("<script>window.opener.location.href=window.opener.location.href;</scri pt> ");this.Response.Write("<script>window.opener.location.href='WebForm1.aspx';</script> ");//弹出提示窗口.确定后弹出子窗口(WebForm2.aspx)this.Response.Write("<script language='javascript'> alert('发表成功!');window.open('WebForm2.aspx')</script> ");//弹出提示窗口,确定后,刷新父窗口this.Response.Write("<script> alert('发表成功!');window.opener.location.href=window.opener.location.href;</s cript> ");//弹出相同的一页<INPUT type="button" value="Button" onclick="javascript:window.open(window.location.href)">//Response.Write("parent.mainFrameBottom.location.href='y ourwebform.aspx?temp=" +str+"';");<SCRIPT LANGUAGE="javascript"><!--window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') //这句要写成一行--></SCRIPT>参数解释:<SCRIPT LANGUAGE="javascript"> js脚本开始;window.open 弹出新窗口的命令;'page.html' 弹出窗口的文件名;'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;height=100 窗口高度;width=400 窗口宽度;top=0 窗口距离屏幕上方的象素值;left=0 窗口距离屏幕左侧的象素值;toolbar=no 是否显示工具栏,yes为显示;menubar,scrollbars 表示菜单栏和滚动栏。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

js实现网页右下角弹出窗口代码
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>JavaScript实现网页右下角弹出窗口代码</title>
</head>
<style type=”text/css”>
#winpop { width:200px; height:0px; position:absolute; right:0; bottom:0; border:1px solid #666; margin:0; padding:1px; overflow:hidden; display:none;}
#winpop .title { width:100%; height:22px; line-height:20px; background:#FFCC00; font-weight:bold; text-align:center; font-size:12px;}
#winpop .con { width:100%; height:90px; line-height:80px; font-weight:bold; font-size:12px; color:#FF0000; text-decoration:underline; text-align:center}
#silu { font-size:12px; color:#666; position:absolute; right:0; text-align:right; text-decoration:underline; line-height:22px;}
.close { position:absolute; right:4px; top:-1px; color:#FFF; cursor:pointer}
</style>
<script type=”text/javascript”>
function tips_pop(){
var MsgPop=document.getElementById(“winpop”);
var popH=parseInt(MsgPop.style.height);//将对象的高度转化为数字
if (popH==0){
MsgPop.style.display=”block”;//显示隐藏的窗口
show=setInterval(“changeH(…up‟)”,2);
}
else {
hide=setInterval(“changeH(…down‟)”,2);
}
}
function changeH(str) {
var MsgPop=document.getElementById(“winpop”);
var popH=parseInt(MsgPop.style.height);
if(str==”up”){
if (popH<=100){
MsgPop.style.height=(popH+4).toString()+”px”;
}
else{
clearInterval(show);
}
}
if(str==”down”){
if (popH>=4){
MsgPop.style.height=(popH-4).toString()+”px”;
}
else{
clearInterval(hide);
MsgPop.style.display=”none”;?? //隐藏DIV
}
}
}
window.onload=function(){//加载
document.getElementById(…winpop‟).style.height=‟0px‟;
setTimeout(“tips_pop()”,800);//3秒后调用tips_pop()这个函数
}
</script>
<body>
<div id=”silu”>
<button onclick=”tips_pop()”>3秒后会在右下角自动弹出窗口,如果没有弹出请点击这个按钮</button>
</div>
<div id=”winpop”>
<div>您有新的短消息!<span onclick=”tips_pop()”>×</span></div>
<div>1条未读信息(</div>
</div>
</body>
</html>。

相关文档
最新文档