导航:首页 > 编程语言 > js怎么弹出div窗口

js怎么弹出div窗口

发布时间:2022-01-20 18:16:46

js如何在本页面点击将另一个页面中的某个div弹出

首先两个页面需要有关联..比如是第一个页面点击链接出现第二个页面..
但点击的时候 需要js生成第二个页面....这样两个就能通讯了...
整理思路就是..
点击链接-js生成子页面,.
这样事件就能互相调用了...

② html如何用JS自动弹出一个DIV

也就先做一个DIV。里面的内容都做好。
此DIV背后加一个mask层。
把这个DIv默认设置为隐藏。
JS里加一个定时器,每隔一分钟,设置为这个DIv的css样式中的display=block

③ 如何js弹出div

js如下:
<script language="javascript">
//登陆弹出对话框,并使背景元素不可用
var div_width = 300;
var div_height = 200;
function showWindow(width,height){
location.href="#";
width = div_width;
height = div_height
var windowstr= document.getElementById("popLayer").innerHTML;
document.getElementById("infoDiv").innerHTML=windowstr;
document.getElementById("infoDiv").style.left=((document.body.clientWidth-width)>0?(document.body.clientWidth-width):0)/2+"px";
document.getElementById("infoDiv").style.top=200+"px";
document.getElementById("infoDiv").style.zIndex=10001;
document.getElementById("infoDiv").style.width=width;
document.getElementById("infoDiv").style.height=height;
document.getElementById("infoDiv").style.border="3px solid #0099ff";
document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
document.getElementById("tranDiv").style.display="";
document.getElementById("tranDivBack").style.display="";
document.getElementById("tranDivBack").style.zIndex=10000;
document.getElementById("infoDiv").style.display="";
}
function closeWindow(){
document.getElementById("tranDiv").style.display="none";
}

</script>

页面中:
<!--层遮罩部分-->
<div style="position:absolute;display:none; left:0px; top:0px;" id="tranDiv">
<div style="position:absolute;left:0px; top:0px; width:100%; height:100%;background-color:#000000;filter:alpha(Opacity=30)" id="tranDivBack"> </div>
<div align='center'style='position:absolute;left:0px; top:0px; width:100%; height:100%; background-color:#e5edf5;background-image:url(images/bestnetqywimg/tccbg.gif);' id='infoDiv'></div>
</div>
<!--层遮罩部分结束-->
<!--弹出层登录-->
<div id="popLayer" style="display:none"><form id="formdl" name="formdl" method="post" action=""><br /><font align="center" color="#0000ff" size="3"><b>---手机号码先登录---</b></font><br /><br />

<br/>
<input type="submit" name="Submit" class="bntccanniu" value="登录" /> <input type="button" name="Submit1" class="bntccanniu" value="取消" onclick="closeWindow();"/>

</form>
</div>
<a href="javascript:;">点击此处看看</a>

④ JS弹出DIV层菜单

你把onmouseout="locking2() 去掉!
然后在点击二级菜单链接时Onclick事件顺便执行locking2() 隐藏操作!

⑤ js怎么实现点击按钮弹出div

那你就看看你们的

专用的弹出div的代码,是怎么弹出来的

还有销毁div弹框的代码在哪里就好了

如果没有销毁的,就获取那个已经弹出的div,设置css隐藏就好了。

⑥ js如何实现关闭js弹出层的窗口

两种方法:去除和隐藏

//创建你的弹出层
var dvMsg = document.createElement("div");
strHtml = "<div class='####'>弹出层内容</div>"
strHtml += " <div class='####'><input type='button' value='关闭' onclick='btnclick()'></div>"
dvMsg.innerHTML = strHtml;
document.body.appendChild(dvMsg);
// 关闭按钮
btnclick = function (){
document.body.removeChild(dvMsg);

-------------------------
或者 弹出层用div id标记

<div id="tanchu">弹出层内容</div>

js里
function open(){
document.getElementById(tanchu).style.display=""; //显示
}
function close(){
document.getElementById(tanchu).style.display="none"; //不显示(页面初始化的时候同样加载一遍)
}

⑦ 简单的js弹出div层

这里有一个弹出层效果
你可以参考一下

⑧ JS弹出DIV窗口,按ESC取消

显示层:

css:
.showdiv
{
width: 100%;
height: auto;
position: absolute;
left: 0;
top: 0;
z-index: 999;
display: none;
}
.count_div
{
width: 500px;
height: 400px;
margin-top: 120px;
margin-left: auto;
margin-right: auto;
margin-bottom: 0;
border: 1px solid #aaaaaa;
background: #fff;
}
.brg
{
width: 100%;
background: #ededed;
position: absolute;
top: 0;
left: 0;
filter: alpha(opacity=60);
-moz-opacity: 0.6;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
display: none;
z-index: 998;
}

js:
function close () {
$("#brg").css("display", "none");
$("#showdiv").css("display", "none");
}
function show() {
$("#brg").css("display", "none");
$("#div_show").css("display", "none");
}
$(document).bind('keydown', 'esc',function (evt){
//关闭层代码
close () ;
return false; });

html:
<!--遮罩层-->
<div class="brg" id="brg">
</div>
<!--显示层-->
<div class="showdiv" id="div_order">
<div class="count_div" id="div_order_count">
内容
</div>
</div>
在网上找一个“jquery.hotkeys.js”的js包,里面都是jquery整理好的热键,
引入jquery包。
$(document).bind('keydown', 'esc',function (evt){
//关闭层代码
return false; });
手敲,未测试,应该不会有太大问题,根据自己内容修改

⑨ javascript如何弹出一个div登录框

<div id=win style="display:none; POSITION:absolute; left:50%; top:50%; width:600px; height:400px; margin-left:-300px; margin-top:-200px; border:1px solid #888; background-color:#edf; text-align:center">这是DIV登录框示例<br><a href="javascript:closeLogin();">关闭登内录框</a></div>
<script>
function openLogin(){
document.getElementById("win").style.display="";
}
function closeLogin(){
document.getElementById("win").style.display="none";
}
</script>
<a href="javascript:openLogin();">打开登容录框</a>

阅读全文

与js怎么弹出div窗口相关的资料

热点内容
2003word审阅 浏览:387
手机时间查找新文件 浏览:695
数据库管理员怎么入行 浏览:852
安卓nba2k17修改能力 浏览:868
win10设置nsf文件共享 浏览:445
同一个网站怎么发文章 浏览:725
苹果翻盖手机多少钱 浏览:815
flash80金鹰教程 浏览:374
怎么把美国的app账号换成中国的 浏览:375
贷款60秒app 浏览:408
捷安特骑行app有什么奖励 浏览:542
网站图片展示代码 浏览:167
asp找回密码 浏览:836
如何知道别人使用我的电脑和看了什么文件 浏览:712
prcs4视频导出后找不到文件 浏览:977
msp430系列单片机实用c语言程序设计 浏览:423
移动硬盘的文件格式 浏览:904
文件本地路径与云路径 浏览:103
进大白菜找不到系统文件 浏览:380
ug装配体找不到文件部件已删除 浏览:629

友情链接