Solved

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

Posted on 2004-08-21
3
24,536 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
Comment Utility
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now