导航:首页 > 编程语言 > 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窗口相关的资料

热点内容
工作文件系统如何建立 浏览:307
利用文件中的内容初始化 浏览:935
马云支付宝用到的大数据技术 浏览:333
厦门大数据战略 浏览:720
6s如何设置app切换 浏览:724
西门子编程软件在官方网站哪里找 浏览:511
大数据社会调研报告 浏览:172
数据中的属性有哪些类型 浏览:176
苹果6手机支付宝加密 浏览:480
大数据的内涵以下理解 浏览:92
word2007组合 浏览:643
定向士官在什么网站报志愿填报 浏览:332
hyp是什么文件格式 浏览:720
编程哪里学靠谱 浏览:224
vfp数据库文件是哪个 浏览:694
移动数据已停用怎么解决 浏览:541
小米2s升级miui7耗电 浏览:837
文件资源管理器最近使用文件找不到 浏览:539
sublimetext文件名乱码 浏览:792
安徽宝德网络技术 浏览:44

友情链接