Closed Thread Icon

Preserved Topic: all gif-animations stopped by javascript Pages that link to <a href="https://ozoneasylum.com/backlink?for=17827" title="Pages that link to Preserved Topic: all gif-animations stopped by javascript" rel="nofollow" >Preserved Topic: all gif-animations stopped by javascript\

 
Author Thread
tea
Nervous Wreck (II) Inmate

From: Bern, Switzerland
Insane since: Aug 2000

posted posted 08-12-2000 22:22

hello there,
i have a toggle-button to turn on and off music. but when i turn on or off the music,
all animated gifs are stopped as a side-effect. how can i prevent the ie5 and ns 4.6 browsers from stopping gif-animations?
sample-code:
<script>
...
function togglemusic() {
if (musicflag == 1) {
document.images['musicbutton'].src = "images/musicoff.jpg";
document.mymusic.stop();
} else {
document.images['musicbutton'].src = "images/musicon.jpg";
document.mymusic.play();
}
musicflag = 1-musicflag;
}
...
</script>
<body>
<a href="JavaScript:togglemusic();"><img alt="" border=0 src="images/musicon.jpg" name=musicbutton align="middle"></a>
</body>

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 08-12-2000 23:22

Ack! As far as I know, you can't. I wasn't aware this was an IE flaw, thought this was only Netscape that did this? Whatever. What's happening is that once you click anywhere, a flag goes off saying "you're leaving now, don't bother running anything on this page!" Annoying. My solution was to cease relying on animated gifs. Sorry about that, not the answer you were hoping for I'll bet.

Your pal, -doc-

Dan
Paranoid (IV) Mad Scientist

From: Calgary, Alberta, Canada
Insane since: Apr 2000

posted posted 08-12-2000 23:50

You can import the .gif's into flash, then save the swf file, and use those instead. I think that would work.

- Dan -

tea
Nervous Wreck (II) Inmate

From: Bern, Switzerland
Insane since: Aug 2000

posted posted 08-13-2000 01:57

that's the first time i saw this side-effect. it both happens on ie 5.0 and netscape 4.6 on my computer.
well here is the link to the page i'm working on: http://www.tea.ch/hotel-seepark/
the stars and flags stop animating when turned off the background music(red button)
very strange.
cu, tea

Dan
Paranoid (IV) Mad Scientist

From: Calgary, Alberta, Canada
Insane since: Apr 2000

posted posted 08-13-2000 03:10

Yup, it's doin it for me too.
Forget my flash idea, also.

Sorry man =[

- Dan -

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 08-13-2000 13:08

You could always replace them all with Javascript animations, as in the http://www.ozones.com/flourish.html page. I like this solution, it can overburden the CPU, but has the potential of being more random, and hence les annoying.

Your pal, -doc-

tea
Nervous Wreck (II) Inmate

From: Bern, Switzerland
Insane since: Aug 2000

posted posted 08-13-2000 14:53

thank you doc, your pages looks very nice.

i've adopted your advice and found a workaround which works for ie5.

the workaround:i'll replace all gif-anims with themself when the music button is pushed.
no workaround found for ns yet.

cu, tea

tea
Nervous Wreck (II) Inmate

From: Bern, Switzerland
Insane since: Aug 2000

posted posted 08-13-2000 16:57

thank you all for your advices.
i now have the solution. <img border=0 align=absmiddle src="http://www.ozones.com/forum/smile.gif">
to change a button with javascript you could do it in two ways.
1. <a href="JavaScript:togglebutton()"><img ..></a>
2. <a href="#" onclick"togglebutton()"><img ..></a>
in my case, the first works "fine" with ie-browsers
the second works normal with ns-browsers.
but none works in both browsers.

here is the workaround which is acceptable by both ie and ns browsers.
i don't like this sorts of incompatiblities.
------------ BEGIN -------------------
<script>
// Begin Music
function togglemusic() {
if (musicflag == 1) {
document.images['musicbutton'].src = "images/musicoff.jpg";
document.mymusic.stop();
} else {
document.images['musicbutton'].src = "images/musicon.jpg";
document.mymusic.play();
}
musicflag = 1-musicflag;
// strange behaviour of internet explorer
if (ie) { workaround(); }
}
function workaround() {
for (i=0;i<4;i++) {
document.images['star'+i].src = "images/star.gif";
}
document.images['de1'].src="images/f-deutschland1.gif";
document.images['fr1'].src="images/f-frankreich1.gif";
document.images['gb1'].src="images/f-gb1.gif";
}
</script>
</head>
<body bgcolor="white" onload="init();">
<script language="JavaScript">
document.write("<table><tr><td align=center><div class=adresse>Music</div></td></tr><tr><td align=center><a href='");
if (ns) {
document.write("#' onclick='togglemusic();' ");
} else {
document.write("JavaScript:togglemusic();' ");
}
document.write("onmouseover='overmusic(1);' onmouseout='outmusic(1)'><img alt='' border=0 src='images/musicon.jpg' name=musicbutton></a></td></tr></table>");

// -->
</script>
...

------------ END ----------------------

well, i now know how to stop animated-gifs ;-)

the complete source is at http://www.tea.ch/hotel-seepark/

cu, tea

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-13-2000 17:41

Just a shot in the dark, but try this:

replace

<a href="JavaScript:togglemusic();">

with

<a href="JavaScript: void togglemusic();">

and see if it works in both browsers. If it does, I'll explain why... if not, forget it. =)

tea
Nervous Wreck (II) Inmate

From: Bern, Switzerland
Insane since: Aug 2000

posted posted 08-13-2000 18:41

thanks Slime,

did not work.
see for yourself at: http://www.tea.ch/hotel-seepark/test.html
animation stopped in both browsers.

cu,tea

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 08-14-2000 20:56

Just thought I'd tell you that on MacOS 9 with IE 5.0 the animation DID NOT STOP when you clicked the buttons. However, the main graphic jumped around the screen annoyingly every time I touched a rollover. And the rollover pop-up text did not appear within the boxes (it appeared under them).

tea
Nervous Wreck (II) Inmate

From: Bern, Switzerland
Insane since: Aug 2000

posted posted 08-14-2000 21:48

thank you very much,
i had no time to test my page on other browsers than ie5,ie4 ns 4.5,4.6 and 6 on ms windows

there are known problems with ie4 and ns6 :-( and now with mac os 9 on ie5

it looks like i'll have to provide different versions.

cu, tea

« BackwardsOnwards »

Show Forum Drop Down Menu