導航:首頁 > 編程語言 > 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窗口相關的資料

熱點內容
少兒編程能做出哪些游戲 瀏覽:156
大數據分析趙麗穎價值 瀏覽:2
iphone來自電腦的照片怎麼刪除 瀏覽:648
姜惠恩禁止的愛 瀏覽:981
三君四妾by小透明 瀏覽:585
修車女女電影 瀏覽:451
數學奧數和編程學哪個好 瀏覽:39
能看的視頻網站推薦一下你懂 瀏覽:208
mvciis配置文件 瀏覽:87
男主姓傅 瀏覽:742
ai全是用什麼編程的 瀏覽:75
手機言情電影 瀏覽:12
w7系統解壓文件 瀏覽:660
新型網路技術演進方向 瀏覽:649
大數據分析的基本方面 瀏覽:42
更新快的電影在線網址 瀏覽:467
ipad給程序上鎖 瀏覽:882
修改yum配置文件 瀏覽:614
州金典網路技術有限公司 瀏覽:642
中小學生網路慈善活動有哪些 瀏覽:306

友情鏈接