zoukankan      html  css  js  c++  java
  • 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">

  • 相关阅读:
    C语言I博客作业02
    C语言I博客作业06
    C语言I—2019秋作业第一周作业
    C语言I博客作业09
    C语言I博客作业07
    C语言I博客作业08
    利用 jrebel 热部署\远程调试\远程热部署 springboot项目 服务器上的代码
    java 双因素认证(2FA)TOTP demo
    java File读取文件始终不存在的问题分析
    exchange 2010 的两个错误
  • 原文地址:https://www.cnblogs.com/wangjunwei/p/1710254.html
Copyright © 2011-2022 走看看