/    Sign up×
Community /Pin to ProfileBookmark

FF and IE problem

Hey guys,

I have the following code which seems to only work in IE. I tried all the different combinations in FF but can’t seem to get it to work, does anyone know the FF equivalent? Or is it something unique to IE?

Code:

[code]document.frames[‘myFrame’].location.href = xmlhttp.responseText[/code]

Thanks much,

Regards,
Pembar

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorJun 23.2009 — has your iframe/frame a [B]name[/B], or an [B]id[/B]?
Copy linkTweet thisAlerts:
@PembarauthorJun 23.2009 — Hey guys,

Here's a more complete example:

<i>
</i>&lt;html&gt;
&lt;body&gt;
&lt;script language="JavaScript"&gt;
function myLocation() {
alert(document.all.myFrame.contentWindow.location);
}
function changeURL(url) {
document.getElementById("urlAddress1").value=url;
document.frames['myFrame'].location.href = url;

}
&lt;/script&gt;
&lt;iframe id="myFrame" src="http://www.google.com" style="width:200;"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;button onclick="changeURL('http://www.yahoo.com');"&gt;Yahoo&lt;/button&gt;&lt;P&gt;
1. &lt;input type="button" name="clickMe2" id="urlAddress1" value="CurrentURL"/&gt;&lt;P&gt;
&lt;/body&gt;
&lt;/html&gt;



It works fine in IE when I click "Yahoo", the frame changes. When I click "Yahoo" in FF, nothing happens.

Any clue?

Thanks much.

Regards,

Pembar
Copy linkTweet thisAlerts:
@KorJun 24.2009 — Try this
<i>
</i>document.getElementById('myFrame').contentWindow.location.href = [I]newurl[/I];
×

Success!

Help @Pembar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...