国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
使用javascript打開模態(tài)對(duì)話框

1. 標(biāo)準(zhǔn)的方法

<script type="text/javascript">  
function openWin(src, width, height, showScroll){  
window.showModalDialog (src,"","location:No;status:No;help:No;dialogWidth:"+width+";dialogHeight:"+height+";scroll:"+showScroll+";");  
}  
</script> 
例:<span style="CURSOR: pointer" onclick="openWin 
(’http://www.deepteach.com’, ’500px’, ’400px’, ’no’)">點(diǎn)擊</span> 

 

2. 要注意的是,F(xiàn)irefox并不支持該功能,它支持的語法是

window.open 
(’openwin.html’,'newWin’, 'modal=yes, width=200,height=200,resizable=no, scrollbars=no’ ); 

 

3. 如何自動(dòng)判斷瀏覽器

<input type="button" value="打開對(duì)話框" onclick="showDialog('#')"/> 
  <SCRIPT   LANGUAGE="JavaScript"> 
  <!-- 
  function   showDialog(url) 
  { 
   if(   document.all   ) //IE 
   { 
   feature="dialogWidth:300px;dialogHeight:200px;status:no;help:no"; 
   window.showModalDialog(url,null,feature); 
   } 
   else 
   { 
     //modelessDialog可以將modal換成dialog=yes 
   feature ="width=300,height=200,menubar=no,toolbar=no,location=no,"; 
   feature+="scrollbars=no,status=no,modal=yes";   
   window.open(url,null,feature); 
   } 
  } 
  //--> 
</SCRIPT>

 

4. 在IE中,模態(tài)對(duì)話框會(huì)隱藏地址欄,而在其他瀏覽器則不一定

【注意】在谷歌瀏覽器中,這個(gè)模態(tài)的效果也會(huì)失效。

 

5. 一般在彈出對(duì)話框的時(shí)候,我們都希望整個(gè)父頁面的背景變?yōu)橐粋€(gè)半透明的顏色,讓用戶看到后面是不可以訪問的

而關(guān)閉對(duì)話框之后又希望還原

 

這是怎么做到的呢?

        ///顯示某個(gè)訂單的詳細(xì)信息,通過一個(gè)模態(tài)對(duì)話框,而且屏幕會(huì)變顏色
        function ShowOrderDetails(orderId) {
            var url = "details.aspx?orderID=" + orderId;

//            $("body").css("filter", "Alpha(Opacity=20)");
            //filter:Alpha(Opacity=50)

            $("body").addClass("body1");

            ShowDetailsDialog(url, "600px", "400px", "yes");

            $("body").removeClass("body1");
        }

另外,有一個(gè)樣式表定義

.body1
{
    background-color:#999999;
    filter:Alpha(Opacity=40);
}

 

6. 如何在頁面之間傳遞數(shù)值

下面的部分,轉(zhuǎn)載自:http://www.cnblogs.com/tohen/archive/2007/12/15/995868.html

(一)showModalDialog使用例子,父窗口向子窗口傳遞值,子窗口設(shè)置父窗口的值,子窗口關(guān)閉的時(shí)候返回值到父窗口.

farther.html
---------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META content="EditPlus" name="Generator">
<META content="" name="Author">
<META content="" name="Keywords">
<META content="" name="Description">
<script language="javascript">
<!--
function openChild(){
var k = window.showModalDialog("child.html",window,"dialogWidth:335px;status:no;dialogHeight:300px");
if(k != null)
        document.getElementById("txt11").value = k;
        }
//-->
</script>
</HEAD>
<BODY>
<FONT face="宋體"></FONT>
<br>
        傳遞到父窗口的值:<input id="txt9" type="text" value="3333333333333" name="txt9"><br>
        返回的值:<input id="txt11" type="text" name="txt11"><br>
        子窗口設(shè)置的值:<input id="txt10" type="text" name="txt10"><br>
<input id="Button1" onclick="openChild()" type="button" value="openChild" name="Button1">
</BODY>
</HTML>

child.html
---------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META content="EditPlus" name="Generator">
<META content="" name="Author">
<META content="" name="Keywords">
<META content="" name="Description">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
</HEAD>
<BODY>
<FONT face="宋體"></FONT>
<br>
        父窗口傳遞來的值:<input id="txt0" type="text" name="txt0"><br>
        輸入要設(shè)置父窗口的值:<input id="txt1" type="text" name="txt1"><input id="Button1" onclick="setFather()" type="button" value="設(shè)置父窗口的值" name="Button1"><br>
        輸入返回的值:<input id="txt2" type="text" name="txt2"><input id="Button2" onclick="retrunValue()" type="button" value="關(guān)閉切返回值" name="Button2">
<input id="Button3" onclick="" type="button" value="關(guān)閉刷新父窗口" name="Button3">
<script language="javascript">
<!--
var k=window.dialogArguments;
//獲得父窗口傳遞來的值
if(k!=null)
        {
        document.getElementById("txt0").value = k.document.getElementById("txt9").value;
        }
//設(shè)置父窗口的值
function setFather()
        {
        k.document.getElementById("txt10").value = document.getElementById("txt1").value
        }
//設(shè)置返回到父窗口的值
function retrunValue()
        {
var s = document.getElementById("txt2").value;
        window.returnValue=s;
        window.close();
        }
//-->
</script>
</BODY>
</HTML>

----------------------------
說明:
由于showModalDialog緩存嚴(yán)重,下面是在子窗口取消客戶端緩存的設(shè)置.也可以在服務(wù)器端取消緩存,參考:
http://adandelion.cnblogs.com/articles/252137.html
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
(二)下面是關(guān)閉刷新父窗口的例子

farther.html
---------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="javascript">
<!--
function openChild()
        {
var k = window.showModalDialog("child.html",window,"dialogWidth:335px;status:no;dialogHeight:300px");
if(k == 1)//判斷是否刷新
        {
        alert('刷新');
        window.location.reload();
        }
        }
//-->
</script>
</HEAD>
<BODY>
<br>
        傳遞到父窗口的值:<input id="txt9" type="text" value="3333333333333" NAME="txt9"><br>
<input type="button" value="openChild" onclick="openChild()" ID="Button1" NAME="Button1">
</BODY>
</HTML>

child.html
----------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META content="EditPlus" name="Generator">
<META content="" name="Author">
<META content="" name="Keywords">
<META content="" name="Description">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
</HEAD>
<BODY>
<FONT face="宋體"></FONT>
<br>
        父窗口傳遞來的值:<input id="txt0" type="text" name="txt0"><br>
<input id="Button1" onclick="winClose(1)" type="button" value="關(guān)閉刷新父窗口" name="Button1">
<input id="Button2" onclick="winClose(0)" type="button" value="關(guān)閉不刷新父窗口" name="Button2">
<script language="javascript">
<!--
var k=window.dialogArguments;
//獲得父窗口傳遞來的值
if(k!=null)
        {
        document.getElementById("txt0").value = k.document.getElementById("txt9").value;
        }
//關(guān)閉窗口返回是否刷新的參數(shù).
function winClose(isRefrash)
        {
        window.returnValue=isRefrash;
        window.close();
        }
//-->
</script>
</BODY>
</HTML>

--------------------------
說明
1.下面是取消客戶端緩存的:
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
也可以在服務(wù)器端取消緩存,參考:
http://adandelion.cnblogs.com/articles/252137.html

2.向父窗口傳遞闡述在ASP.NET中也可以是用aaa.aspx?id=1的方式傳遞.

3.不刷新父窗口的話在父窗口中直接這樣一來設(shè)置可以.
<script>
window.showModalDialog("child.html",window,"dialogWidth:335px;status:no;dialogHeight:300px");
</script>
4.在子窗口中若要提交頁面的話要加入:,這樣就不會(huì)打開新窗口了.
<head>
<base target="_self">
</HEAD>

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
showModalDialog/showModelessDialog實(shí)例,子窗口關(guān)閉的時(shí)候...
JSP常用開發(fā)技巧(1)
【jquery】基于 jquery 實(shí)現(xiàn) ie 瀏覽器兼容 placeholder 效果
在同一form表單中如何提交兩個(gè)不同的action
web開發(fā)常用小技巧(下)
Dreamweaver網(wǎng)頁制作基礎(chǔ)大全
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服