Solved

IFRAME deactivate

Posted on 2004-08-05
8
511 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert Button on a table 16 47
Word, Excel, Access icons 4 21
message Alert on an empty search 10 29
Increase image taller on inner pages 2 11
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
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).

735 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