JS弹框
来源:互联网 发布:豫广网络投诉电话 编辑:程序博客网 时间:2024/05/18 23:58
JS:
/*************************Begin弹出框*******************************////显示弹出框///参数: url:url 地址,title:标题,width:宽度,height:高度var isFirstPop = true;var isIE6 = isIE6();function showDiv(url, title, width, height) { //第一次运行时加载弹框 if (isFirstPop == true) { loadShowDiv(); isFirstPop = false; } //当前页面 Url(用作BackUrl参数) $("#hidBackUrl").val(document.location); //获取上下的宽度和高度 var sw = document.documentElement.clientWidth; var sh = document.documentElement.clientHeight; //sh = isIE6 ? sh - 30 : sh; //sw = isIE6 ? sw - 200 : sw; //alert(sw); var lw = (sw - width) / 2 - 110 + "px"; var th = (sh - height) / 2 - 22 + "px"; //设置页面的上和左侧的距离 $("#DialogDiv").css("top", th); $(".popUpWrap").css("left", lw); // 设置背景的宽和高 $("#BgDiv").css({ display: "block", height: sh, width: sw }); $("#BgDiv").css({ _height: "1000px" }); //设置框架的浏览的Url地址 $("#iframe").attr("src", url); var yscroll = document.documentElement.scrollTop; $(".popUpWrap").css("width", width); $(".popUpWrap").css("overflow", "hidden"); $(".popUpCont01").css("width", width); $(".popUpCont02").css("height", height); $("#DialogDiv").css("display", "block"); document.documentElement.scrollTop = 0; $("#title").html(title);}//加载弹出框function loadShowDiv() { var div = document.createElement("div"); div.setAttribute("id", "bgdivPop");// div.setAttribute("style", "position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;");// var obj = document.createElement("iframe");// obj.setAttribute("id", "iframeDiv");// obj.setAttribute("hspace", 0);// obj.setAttribute("frameborder", 0);// obj.setAttribute("vspace", 0);// obj.setAttribute("height", "100%");// obj.setAttribute("width", "100%");// obj.setAttribute("style", "position:absolute;_position:none;left:0;top:0;z-index:10;background:#ededed;"); var obj2 = document.createElement("div"); obj2.setAttribute("id", "DialogDiv"); obj2.setAttribute("style", "display:none"); var obj1 = document.createElement("div"); obj1.setAttribute("id", "BgDiv");// obj1.appendChild(obj); div.appendChild(obj1); div.appendChild(obj2); document.body.appendChild(div); var val = getShowDiv(); document.getElementById("DialogDiv").innerHTML = val; $("#btnClose").click(function () { // closeShowDiv(); $('#_my97DP', parent.document).css("display", "none"); $("#BgDiv").css("display", "none"); $("#DialogDiv").css("display", "none"); });}//关闭div不刷新function closeShowDiv() { var dd = parent.document.getElementById("BgDiv") var divb = parent.document.getElementById("DialogDiv") $(dd).css("display", "none") $(divb).css("display", "none") }//关闭弹出框//url:父页面//当在自定义按钮上调用时需要传入url。弹出框自带的关闭图标不需要传function closeDivAndReflash(url) { if (url == undefined) { url = $("#hidBackUrl").val(); window.parent.showcontent.location.href = url; } else { window.parent.location.href = url; }}//弹出窗口内容function getShowDiv() { var popContent = ""; popContent += "<div class='clearfix popUpWrap'>" popContent += "<div class='popUpTitleRight'></div>" popContent += "<div class='popUpTitleLeft'></div>" popContent += "<div class='popUpTitleH3'></div>" popContent += "<div class='popUpCont'>" popContent += "<div class='popUpCont01'>" popContent += "<div class='popUpCont02'>" popContent += "<div class='clearfix titleDivCss'>" popContent += "<h3 class='fr TitleClose'><a href='#' id='btnClose'></a></h3>" popContent += "<input type='hidden' id='hidBackUrl'>"; popContent += "<div class='fl TitleInfo' id='Strtitle' style=''><span class='iconTitle01'></span><span id='title'></span></div></div>" popContent += "<div class='contMiddle' style=''>" popContent += "<iframe name='' id='iframe' class='Megalab_Class_main_right_iframe' marginwidth='0' marginheight='0' hspace='0' height='100%' width='100%' vspace='0' frameborder='0' scrolling='auto' style='*position:absolute;'>" popContent += "</iframe>" popContent += "</div></div></div></div>" popContent += "<div class='popUpBottRight'></div>" popContent += "<div class='popUpBottLeft'></div>" popContent += "<div class='popUpBottMiddle'></div>" popContent += "</div>" return popContent;}/*************************End弹出框*******************************/HTML:
var url = '@Url.Content("~/UserManage/NewUser?method=adduser")'; showDiv(url, '@ViewBag.New', 680, 483);
- JS弹框
- js弹框
- js弹框
- 简单的js弹框
- js
- js
- JS
- JS
- JS
- js
- js
- js
- js
- js
- JS
- js
- JS
- js
- extjs介绍(百度百科)
- android标题栏显示进度条
- 如何配置 tomcat 服务器
- cts测试步骤
- Spring配置文件和各个属性分析
- JS弹框
- Android最全面试题71道题 详解
- 谈谈Unicode编码,简要解释UCS、UTF、BMP、BOM等名词
- Effective java 读书笔记( 二 )
- oracle更改数据库字符集编码UTF8
- FreeEIM在树上一会儿荡秋千
- C#遍历访问Dictionary和HashTable
- irf(智能弹性架构)
- LSH Locality-Sensitive Hashing 局部敏感哈希