Solved

IFRAME deactivate

Posted on 2004-08-05
8
509 Views
Last Modified: 2008-02-01
hi expertz,

i am using a form, in which i use IFRAME to show up dialogs instead of WINDOW.OPEN or SHOWMODALDIALOG.

my problem is when IFRAME is active, and we click outside the IFRAME, the IFRAME disappears, is it possible to SHOW the IFRAME till a CANCEL button in the IFRAME is clicked ?

thanks
-ravig
0
Comment
Question by:rkg_eagle
  • 2
  • 2
8 Comments
 
LVL 8

Expert Comment

by:RozanaZ
ID: 11726070
Hi,
Can you post your code, please? Or just an example?
0
 

Author Comment

by:rkg_eagle
ID: 11726369
hi rozanaz,

-- main.html
<html>
<script language=javascript>
function OpenDlg()
{
            document.frames("DialMatrix").document.body.innerHTML = "Loading...";
                         document.frames("DialMatrix").style.display='block';
            document.frames("DialMatrix").src = "test.htm";
}
</script>

<input type=button value=Activate onclick=OpenDlg()>

<iframe id="DM" name="DM" onfocusout="Focusout()" style="display:none;position:absolute;width:600;height:400;z-index:3;border=1 black solid;"></iframe>
</html>

-- test.html
<html>
<script language=javascript>
function Close()
{
      frameElement.style.display = 'none';
}
</script>
<input type=button value=Close onclick=Close()>
</html>

i ll display the main.html first, onclick of button this frame is shown. the IFRAME should close only on clicking the CLOSE button in test.html. it should not close even if the user clicks on the visible portions of main.html

thanks
-ravig
0
 

Author Comment

by:rkg_eagle
ID: 11726386
hi rozanaz,

-- main.html
<html>
<script language=javascript>
function OpenDlg()
{
          document.frames("DM").document.body.innerHTML = "Loading...";
          document.frames("DM").style.display='block';
          document.frames("DM").src = "test.htm";
}
</script>

<input type=button value=Activate onclick=OpenDlg()>

<iframe id="DM" name="DM" onfocusout="Focusout()" style="display:none;position:absolute;width:600;height:400;z-index:3;border=1 black solid;"></iframe>
</html>

-- test.html
<html>
<script language=javascript>
function Close()
{
     frameElement.style.display = 'none';
}
</script>
<input type=button value=Close onclick=Close()>
</html>

i ll display the main.html first, onclick of button this frame is shown. the IFRAME should close only on clicking the CLOSE button in test.html. it should not close even if the user clicks on the visible portions of main.html

thanks
-ravig
0
 
LVL 8

Accepted Solution

by:
RozanaZ earned 25 total points
ID: 11726554

Hi  rkg_eagle,

Try to remove:

 onfocusout="Focusout()"

from

<iframe id="DM" name="DM" onfocusout="Focusout()" style="display:none;position:absolute;width:600;height:400;z-index:3;border=1 black solid;"></iframe>
0
 
LVL 7

Assisted Solution

by:zac_charles
zac_charles earned 25 total points
ID: 11741438
this works fine, i changed your javascript around a little bit, the result is the same (apart from this way works ;) and it also will work in all browsers now.

All you have to change is main.html

<html>

<head>
  <script language=javascript>
    function OpenDlg()
    {
      document.frames['DM'].document.body.innerHTML="Loading...";
      document.getElementById('DM').style.display="block";
      document.frames['DM'].location.href="test.html";
    }
  </script>
</head>

<body>
  <input type=button value=Activate onclick=OpenDlg()>
  <iframe name="DM" id="DM" style="display:none;position:absolute;width:600;height:400;z-index:3;border=1 black solid;"></iframe>
</body>

</html>
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

776 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