/    Sign up×
Community /Pin to ProfileBookmark

javascript explorer browser problem

hello:

this is the first time i’m in this forum, and I would like that you help me with the following problem.

I’ve done a site in flash ([url]www.virtualflyer.net)[/url], the thing is that I have it in an html page and I change the backgroun images of the html from my .swf. My problem is that you can see it fine in safari, but not in explorer.

I think is because “array” problem.

The javasecript in the main file is the following:

<script language=”JavaScript”>

var backImage = new Array();

backImage[0] = “fondosback/fondo1.jpg”;
backImage[1] = “fondosback/fondo2.jpg”;
backImage[2] = “fondosback/fondo3.jpg”;
backImage[3] = “fondosback/fondo4.jpg”;

function changeBGImage(whichImage){
if(document.body){
document.body.background = backImage[whichImage];
}
}

</script>

Then, in the swf I wrote:
on (press) {
getURL (“JavaScript:changeBGImage(‘2’)”);
}

O safari you see how the background changes, but not in explorer.
I tried not using “Array”, with:

<script language=”JavaScript”>
function changeBgColor(newBgColor) {
document.bgColor = newBgColor;
}
</script>

And it works in explorer (changing the colors), but not in safari..

Is there a way to change background images from swf that works in explorer.

Please, help me, it’s important for my work.

Thanx very much,

Cristina

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@balloonbuffoonMar 29.2006 — Try changing:
[CODE]
document.body.background = backImage[whichImage];
[/CODE]

to
[CODE]
document.body.style.backgroundImage = backImage[whichImage];
[/CODE]


--Steve
Copy linkTweet thisAlerts:
@crissyauthorMar 29.2006 — thanx for asking that soon...I've tried wht you said, but doesn't work neither for safari or explorer.
×

Success!

Help @crissy 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...