/    Sign up×
Community /Pin to ProfileBookmark

Function works in IE but not Firefox

Hi all,
This method of calling the function works fine in IE but for some reason FireFox fails to call the function. Please if anyone can help I would appreciate it.
This is a basic example of what I am trying to achieve.

—- code below —-

[CODE]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title>Browser Compatability – Javascript call</title>
<SCRIPT language=JavaScript>
function createBanner() {
alert(“This is a Banner”);
var logoContent = “<img height=100 src=’http://www.bmw.com.au/common_content/bmw/carsales/header_banner.jpg’ width=100>”;
document.write(logoContent);
document.close();
}
function createLogo() {
alert(“This is a Logo”);
var logoContent = “<img height=90 src=’http://www.bmw.com.au/common_content/bmw/carsales/logo_bmw_group_australia.gif’ width=183>”;
document.write(logoContent);
document.close();
}
</SCRIPT>
</head>

<body>
<SCRIPT language=JavaScript> createBanner(); </SCRIPT>
<SCRIPT language=JavaScript> createLogo();</SCRIPT>
</body>
</html>
[/CODE]

Thanks

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonOct 11.2005 — I tested in Firefox 1.0.7 and it runs just fine. Perhaps you have JavaScript disabled.
Copy linkTweet thisAlerts:
@KravvitzOct 11.2005 — Try removing document.close(). You don't need it anyway.
Copy linkTweet thisAlerts:
@ticktackauthorOct 11.2005 — Hi David and Kravvitz,

Thanks for your help.

I appreciate your help. David you were absolutly correct. I have been testing some pages with JS disabled. Boy I feel stupid!

Thanks again for your help.
Copy linkTweet thisAlerts:
@David_HarrisonOct 11.2005 — No problem, happy to help. ?

Incidentally, you on;t need the document.close() when you are writing to pop-up windows. After the document.close() in a pop-up, any further document.write()'s will over-write what is currently there.
×

Success!

Help @ticktack 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.28,
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,
)...