Solved

IFRAME deactivate

Posted on 2004-08-05
8
503 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
Comment Utility
Hi,
Can you post your code, please? Or just an example?
0
 

Author Comment

by:rkg_eagle
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

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

16 Experts available now in Live!

Get 1:1 Help Now