• JS模态窗口


    父页面 弹出 窗口:

    function showTDYT()
    {
       //打开模态子窗体,并获取返回值
       var result=showModalDialog('土地储备-用途.htm','这里随便命名','dialogWidth:320px;dialogHeight:530px;center:yes;help:no;resizable:no;status:no');
       $("#txtYongTu").val(result);
    }

    子页面的方法和返回值:

     function tc() //参数分别为id,name和password
    {
       var getCC=$("#cc").text(); //获取想要的值
       window.returnValue= getCC;   //返回 结果   
       window.close();          //firefox不支持window.close()
    }

    代码
    <script language="javascript" type="text/javascript">
    function InsertTag(tagname)
    {
    if(window.opener.document.getElementById("Editor_Edit_Advanced_txbTag").value == '')
    {
    window.opener.document.getElementById(
    "Editor_Edit_Advanced_txbTag").value += tagname;
    }
    else
    {
    window.opener.document.getElementById(
    "Editor_Edit_Advanced_txbTag").value += "," + tagname;
    }

    }
    </script>

    <a onclick="InsertTag('CSS')" href="#">CSS</a>

    1、使用脚本关闭窗口时防止出现确认框

    在做网页的时候,有时候在完成某个功能的时候需要关闭当前窗口,但现在的新版的浏览器中在使用脚本 window.close() 方法来关闭窗口时,总是会出现一个确认框,这带来非

    常不好的体验。最近在网上又找到了一种新方法,这个可以防止出现确认框:
    window.opener = null;
    window.open("", "_self");
    window.close();

    2、防止 showModalDialog 方法打开网页时总是显示缓存
    在使用 showModalDialog 方法显示网页的时候,如果不做什么设置,基本每次都是显示一个缓存的页面,这在开发的时候是个很麻烦的事,如果不让它显示缓存呢?其实只要在网

    页的 区加上下面一段代码就可以了:
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">

  • 相关阅读:
    P2149 [SDOI2009]Elaxia的路线
    P1346 电车
    P3174 [HAOI2009]毛毛虫
    P3047 [USACO12FEB]附近的牛Nearby Cows
    P4053 [JSOI2007]建筑抢修
    P2607 [ZJOI2008]骑士
    [HNOI2006]马步距离
    [POI2014]Hotel
    [BZOJ3856]Monster
    [BZOJ2819]Nim
  • 原文地址:https://www.cnblogs.com/wangjunwei/p/1710254.html
Copyright © 2020-2023  润新知