gPopupMask = document.getElementById("popupMask")你这样注册脚本的时候,HTML上面那个popupMask还没生成的吧
解决方案 »
- 将一个aspx页分解为近十个用户控件(ascx),对性能有什么影响?
- 前辈指点Discuz.Forum.Users.CheckPassword(username, password, true);
- 如何找到页面中的自定义控件,就和其他findcontrol那样
- 拜求解决方案,急
- 一个关于SqlDataReader的问题!!
- treeview控件使用的问题,在线等。
- 一个商店系统,做到显示收藏的商品这里有些问题,
- 如何在自定义控件中,添加自定义的处理事件。
- .aspx和.ascx在asp.net中的区别是什么?
- 请问我怎样把数据表格的每一行数据分别打印出来?
- 文件上传 大小超过
- 关于datalist里的linkbutton问题
2.jquery的ready。
看下RegisterStartupScript 的API就知道了楼主可以 后台把html拼接好 然后返回给前台 前台处理数据
// Add the HTML to the body
theBody = document.getElementsByTagName('BODY')[0];
popmask = document.createElement('div');
popmask.id = 'popupMask';
popcont = document.createElement('div');
popcont.id = 'popupContainer';
popcont.innerHTML = '' +
'<DIV class="x-window x-window-plain x-window-dlg" id="ext-comp-1001" style="DISPLAY: block; Z-INDEX: 9003; VISIBILITY: visible;WIDTH: 300px; POSITION: absolute; TOP: 116px;LEFT: 354px;">' +
'<DIV class="x-window-tl">' +
'<DIV class="x-window-tr">' +
'<DIV class="x-window-tc">' +
'<DIV class="x-window-header x-unselectable x-window-draggable" id="ext-gen15" style="MozUserSelect: none; KhtmlUserSelect: none" unselectable="on">' +
'<DIV class="x-tool x-tool-close " id="ext-gen59" onclick="hidePopWin(false);" style="DISPLAY: block">' +
' ' +
'</DIV>' +
'<SPAN class="x-window-header-text" id="popupTitle">' +
'Address' +
'</SPAN>' +
'</DIV>' +
'</DIV>' +
'</DIV>' +
'</DIV>' +
'<DIV class="x-window-bwrap" id="ext-gen16">' +
'<DIV class="x-window-ml">' +
'<DIV class="x-window-mr">' +
'<DIV class="x-window-mc">' +
'<!-- Start-->' +
'<div id="popBodyBox">' +
'</div>' +
'<!-- End-->' +
'</DIV>' +
'</DIV>' +
'</DIV>' +
'<DIV class="x-window-bl">' +
'<DIV class="x-window-br">' +
'<DIV class="x-window-bc">' +
'<DIV class="x-window-footer" id="ext-gen18"></DIV>' +
'</DIV>' +
'</DIV>' +
'</DIV>' +
'</DIV>' +
'</DIV>' theBody.appendChild(popmask);
theBody.appendChild(popcont); gPopupMask = document.getElementById("popupMask");
gPopupContainer = document.getElementById("ext-comp-1001");
gShadowBox = document.getElementById("ShadowBox"); gpopBodyBox = document.getElementById("popBodyBox"); // check to see if this is IE version 6 or lower. hide select boxes if so
// maybe they'll fix this in version 7?
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
gHideSelects = true;
}
gPopupContainer.style.display = "none";
// Add onclick handlers to 'a' elements of class submodal or submodal-width-heigh iframestring = '<iframe src="" style="width:100%;height:100%;background-color:transparent;display:none;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%"></iframe><iframe src="" style="width:100%;height:100%;background-color:transparent;display:none;" scrolling="no" frameborder="0" allowtransparency="true" id="popupFrameno" name="popupFrameno" width="100%" height="100%"></iframe>';
gpopBodyBox.innerHTML = iframestring;
}现在想在B.aspx页面执行
Button按钮完后再通过RegisterStartupScript关掉遮盖层。function hidePopWin(callReturnFunc) {
if (typeof (hidePopWined) == "function") { hidePopWined(); } gPopupIsShown = false;
var theBody = document.getElementsByTagName("BODY")[0];
theBody.style.overflow = "";
restoreTabIndexes();
if (gPopupMask == null) {
return;
}
gPopupMask.style.display = "none";
gPopupContainer.style.display = "none";
if (callReturnFunc == true && gReturnFunc != null) {
//alert(window.frames["popupFrame"].returnVal);
gReturnFunc(window.frames[gDefaultFrameID].returnVal);
}
gPopFrame.src = gDefaultLogin;
gPopFrameno.src = gDefaultLogin;
//gpopBodyBox.innerHTML = "";
// display all select boxes
if (gHideSelects == true) {
displaySelectBoxes();
}
}
</script>
<script type= text/javascript defer=defer>$(document).ready(function(){hidePopWinSc(false)})</script></form>
</body>
</html>
通过RegisterStartupScript在后台生成的还是gPopupMask=null。