Solved

ASP.NET (VB.NET) - Pop Up Window Issue

Posted on 2004-08-21
3
24,545 Views
Last Modified: 2013-11-28
Hi,

I am having a main window and I am opening a pop-up window from this main window. From the pop-up window I need to open another pop-up as a modal window. When I open this model window all controls in the scond pop-up vanishes and once the user enters  the value in the third pop-up window the controls in the second pop-up window regains all its control. I don't want to refresh the second pop-up after the modal dialog is closed. That I can do with windows.opener.location.href. I want the second pop-up not to loose the controls when another modal dialog is opened from the same.

Thanks,
Prasanna
0
Comment
3 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 100 total points
ID: 11862464
Hi

Are you talking among the lines of this:?

Main Page
main.html
==============
<html>
<head>
<title>Test Main Page</title>
</head>
<body>
<input type="button" value="Launch First Popup" onclick="window.open('firstPopup.html','','width=400,height=400');">
</body>
</html>

First Popup Window
firstPopup.html
==============
<html>
<head>
<title>Test First Popup Window</title>
<script language="javascript">
<!--

//Below function will not hide launchModal button because if the user has a popup blocker, you're screwed
function hideControls() {
   var alltags = (document.getElementsByTagName) ? document.getElementsByTagName("*") : (document.all) ? document.all : document.layers;
   for (var i=0;i<alltags.length;i++) {
      if (alltags[i].name=="launchModal" || alltags[i].tagName=="BODY" || alltags[i].tagName=="HTML") {
         continue;
      } else {
         (document.layers) ? alltags[i].visibility="none" : alltags[i].style.visibility="hidden";
      }
   }
}

function showControls() {
   var alltags = (document.getElementsByTagName) ? document.getElementsByTagName("*") : (document.all) ? document.all : document.layers;
   for (var i=0;i<alltags.length;i++) {
      (document.layers) ? alltags[i].visibility="show" : alltags[i].style.visibility="visible";
   }
}

// -->
</script>
</head>
<body>
<input type="button" value="Launch Modal Dialog" name="launchModal" onclick="hideControls();window.showModalDialog('modalPopup.html',window);showControls();"><br>
NOW, A LOT OF TEST STUFF
<p>&lt;p&gt;THIS IS A <P> TAG!&lt;/p&gt;</p>
<div>&lt;div&gt;THIS IS A <DIV> TAG!&lt;/div&gt;</div>
<span>&lt;span&gt;THIS IS A <SPAN> TAG!&lt;/span&gt;</span><br>
<input type="button" value="THIS IS A BUTTON!"><br>
<input type="submit" value="THIS IS A SUBMIT BUTTON!"><br>
<input type="reset" value="THIS IS A RESET BUTTON!"><br>
<input type="text" value="THIS IS TEXTFIELD!"><br>
<input type="password" value="THIS IS PASSWORD!"><br>
<textarea>THIS IS A TEXTAREA</textarea>
</body>
</html>


This firstPopup.html is the brain behind this. It popups a modal window and hides all the elements on the page that have tags surrounding them (except the first button, but you can disable that, and for all text not in tags, just put <span> around them).

It uses the fact that it does hideControls, then opens the modal dialog, but because modal dialog stops Javascript on main page, when it closes, it does showControls. If you use a DHTML equivalent or a normal window, you'd need to use onunload="opener.showControls();".


Regards,
Zyloch
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn about the eCommerce marketing trends for the year ahead.
Online promotion is consistently becoming more important for all types of businesses. From Facebook ads to search engines to YouTube videos, there are all sorts of channels that can effectively be used to promote a business or product. But how shoul…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question