From: Defacta on
Hi !

I have the HTML source like this:
<iframe name="Content_IF" name="Content_IF" border=0
width="200" height="200" src="iframe_login.php"></iframe>

And I tried to change the source of the iframe like this:
document.frames.Content_IF.location.href = 'iframe.php';
or like this:
document.Content_IF.location.href = 'iframe.php';

These 2 ways work with IE but none of them work with Firefox, how to
change the src of an iframe with Firefox ?

Thanks,
Vincent.
From: VK on
On Dec 1, 2:49 pm, Defacta <vincent.margue...(a)gmail.com> wrote:
> Hi !
>
> I have the HTML source like this:
> <iframe name="Content_IF" name="Content_IF" border=0
> width="200" height="200" src="iframe_login.php"></iframe>
>
> And I tried to change the source of the iframe like this:
> document.frames.Content_IF.location.href = 'iframe.php';
> or like this:
> document.Content_IF.location.href = 'iframe.php';
>
> These 2 ways work with IE but none of them work with Firefox, how to
> change the src of an iframe with Firefox ?

Document object has nothing to do with the task: though IE has
internal "wrong programming allowance fixes" for the most common
developers errors, like this one or say calling location.href(URL) as
a method. To be compatible with all UAs use the right way, do not
depend on IE's specific error correction mechanics:

self.frames['Content_IF'].src = newURL;

From: Defacta on
On 1 déc, 12:59, VK <schools_r...(a)yahoo.com> wrote:
> On Dec 1, 2:49 pm, Defacta <vincent.margue...(a)gmail.com> wrote:
>
> > Hi !
>
> > I have the HTML source like this:
> > <iframe name="Content_IF" name="Content_IF" border=0
> > width="200" height="200" src="iframe_login.php"></iframe>
>
> > And I tried to change the source of the iframe like this:
> > document.frames.Content_IF.location.href = 'iframe.php';
> > or like this:
> > document.Content_IF.location.href = 'iframe.php';
>
> > These 2 ways work with IE but none of them work with Firefox, how to
> > change the src of an iframe with Firefox ?
>
> Document object has nothing to do with the task: though IE has
> internal "wrong programming allowance fixes" for the most common
> developers errors, like this one or say calling location.href(URL) as
> a method. To be compatible with all UAs use the right way, do not
> depend on IE's specific error correction mechanics:
>
> self.frames['Content_IF'].src = newURL;

Actually, the problem was in my HTML code, I had name="Content_IF"
instead of id="Content_IF"

Thanks,
Vincent.
From: Thomas 'PointedEars' Lahn on
Defacta wrote:
> On 1 d�c, 12:59, VK <schools_r...(a)yahoo.com> wrote:
>> On Dec 1, 2:49 pm, Defacta <vincent.margue...(a)gmail.com> wrote:
>>> I have the HTML source like this:
>>> <iframe name="Content_IF" name="Content_IF" border=0
>>> width="200" height="200" src="iframe_login.php"></iframe>
>>> And I tried to change the source of the iframe like this:
>>> document.frames.Content_IF.location.href = 'iframe.php';
>>> or like this:
>>> document.Content_IF.location.href = 'iframe.php';
>>> These 2 ways work with IE but none of them work with Firefox, how to
>>> change the src of an iframe with Firefox ?
>> Document object has nothing to do with the task: though IE has
>> internal "wrong programming allowance fixes" for the most common
>> developers errors, like this one or say calling location.href(URL) as
>> a method. To be compatible with all UAs use the right way, do not
>> depend on IE's specific error correction mechanics:
>>
>> self.frames['Content_IF'].src = newURL;
>
> Actually, the problem was in my HTML code, I had name="Content_IF"
> instead of id="Content_IF"

Actually, this is one of these rare occasions where VK is almost right. If
you only change `name' to `id', your code will become even more unreliable
than it is now. Therefore, you should use the `name' attribute and the
proper collections instead:

window.frames['Content_IF'].location = newURL;


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16