By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,813 Members | 2,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,813 IT Pros & Developers. It's quick & easy.

popup causing iframe target to be ignored

P: n/a
I use an iframe on my home page and everything works perfectly. But
now I decided to add a popups to my page. The popups come not from
within the iframe but from the parent frame. Again, everything
regarding the popup works perfectly, it pops up with the correct data.
But the strange thing is now any link that targets the iframe simply
get ignored and instead of displaying things in the iframe they get
displayed in a new browser window because apparently they can no longer
resolve the iframe target name. One such button link is:

<a href="main.html" target=Iframe>
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>

(Where Iframe is the name and ID of the iframe). Again it works
correctly until the popup appears.
The iframe and popup's really have nothing to do with each other as
they are in different parts of the code.
I'm posting this question here because I use javascript to pop up the
popup window:

<a
href="javascript:popUpScrollWindow('showprofile.ph p?id={$user.id}','top',650,600)"

It isn't realistic to post all my code here as there are 100's of lines
involved. But I would like to know if anyone has an idea why a popup
would cause the iframe target to suddenly be ignored. Again all
the code works perfectly until the popup is displayed.
It's almost as if the popup window is causing the main frame to
somehow partially lose focus even though everything is still
selectable.
Also, it doesn't matter if you close the popup window or leave it
up. The same result with the iframe target occurs.

Any help appreciated - Ukrbend

Feb 3 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
> But the strange thing is now any link that targets the iframe simply
get ignored and instead of displaying things in the iframe they get
displayed in a new browser window because apparently they can no longer
resolve the iframe target name. One such button link is:

<a href="main.html" target=Iframe>
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>

If this link belong to parent document try this:
<a href="javascript:document.getElementById('...').sr c='main.html'">
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a> ,
where '...' is iframe ID

If this link belong to document that loaded in the iframe:
<a href="javascript:document.location.href='main.html '">
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>

Feb 3 '06 #2

P: n/a
ukrbend said the following on 2/3/2006 8:32 AM:
I use an iframe on my home page and everything works perfectly. But
now I decided to add a popups to my page. The popups come not from
within the iframe but from the parent frame. Again, everything
regarding the popup works perfectly, it pops up with the correct data.
But the strange thing is now any link that targets the iframe simply
get ignored and instead of displaying things in the iframe they get
displayed in a new browser window because apparently they can no longer
resolve the iframe target name. One such button link is:

<a href="main.html" target=Iframe>
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>

(Where Iframe is the name and ID of the iframe). Again it works
correctly until the popup appears.
The iframe and popup's really have nothing to do with each other as
they are in different parts of the code.
I'm posting this question here because I use javascript to pop up the
popup window:

<a
href="javascript:popUpScrollWindow('showprofile.ph p?id={$user.id}','top',650,600)"
http://jibbering.com/faq/#FAQ4_24
<a href="showprofile.php?id={$user.id}" target="myWindow"
onclick="popUpScrollWindow(this.href,this.target,6 50,600);return false">

Now it works without scripting enabled.

Also, do not use "top" as a window name. It is a reserved word in
Javascript.

Also, I personally wouldn't use IFrame as the name/ID of an IFrame.
It isn't realistic to post all my code here as there are 100's of lines
involved.


No it's not, but posting the contents of popUpScrollWindow *would* be a
good idea.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 3 '06 #3

P: n/a
marss said the following on 2/3/2006 8:47 AM:
But the strange thing is now any link that targets the iframe simply
get ignored and instead of displaying things in the iframe they get
displayed in a new browser window because apparently they can no longer
resolve the iframe target name. One such button link is:

<a href="main.html" target=Iframe>
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>
If this link belong to parent document try this:
<a href="javascript:document.getElementById('...').sr c='main.html'">
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a> ,
where '...' is iframe ID


And then ditch it as bad code?
If this link belong to document that loaded in the iframe:
<a href="javascript:document.location.href='main.html '">
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>


And then ditch it as bad code?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 3 '06 #4

P: n/a
> > If this link belong to document that loaded in the iframe:
<a href="javascript:document.location.href='main.html '">
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>


And then ditch it as bad code?


Yes, I make a mistake. There is a simple solution if this link belongs
to document that loaded in the iframe:
<a href="main.html">
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle">
</a>

Feb 3 '06 #5

P: n/a
Thanks for the help. Unfortunately no suggestions worked. I even tried
to write
some test pages but can't replicate the problem. I think it has
something to
do with how I am using templates with php, or God just hates me and
wants
me to suffer. The latter is more probable.

Feb 3 '06 #6

P: n/a
For those interested, I got this crap to work with the
help Randy Webb. Just a slight variation from his
advice:

<a href="#"
onClick="window.open('showprofile.php?id={$user.id }','popUpWin','
width=650,height=600,
scrollbars=no','focus()')">{$user.username}</a>"

Feb 3 '06 #7

P: n/a
ukrbend wrote:
I use an iframe on my home page and everything works perfectly. But
now I decided to add a popups to my page. The popups come not from
within the iframe but from the parent frame. Again, everything
regarding the popup works perfectly, it pops up with the correct data.
But the strange thing is now any link that targets the iframe simply
get ignored and instead of displaying things in the iframe they get
displayed in a new browser window because apparently they can no longer
resolve the iframe target name. One such button link is:

<a href="main.html" target=Iframe>
<img src="images/button_home.gif" alt=Home border=0
align="absmiddle"></a>

(Where Iframe is the name and ID of the iframe). Again it works
correctly until the popup appears.
The iframe and popup's really have nothing to do with each other as
they are in different parts of the code.
I'm posting this question here because I use javascript to pop up the
popup window:

<a
href="javascript:popUpScrollWindow('showprofile.ph p?id={$user.id}','top',650,600)"

It isn't realistic to post all my code here as there are 100's of lines
involved. But I would like to know if anyone has an idea why a popup
would cause the iframe target to suddenly be ignored. Again all
the code works perfectly until the popup is displayed.
It's almost as if the popup window is causing the main frame to
somehow partially lose focus even though everything is still
selectable.
Also, it doesn't matter if you close the popup window or leave it
up. The same result with the iframe target occurs.

Any help appreciated - Ukrbend


IMHO, you have to launch first the window with the iframe as a NEW
WINDOW, so you can name it (for instance window1). Once the window with
the iframe is named, you can target it from the popup, wich is in an
other new window (window2 for instance).

Ignace de Witte
http://www.reunionislandguns.com
Feb 5 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.