Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice needed for Flash/CSS/JavaScript problem

Status
Not open for further replies.

georgeocrawford

Technical User
Joined
Aug 12, 2002
Messages
111
Location
GB
Hi there - wonder if anyone can help...

I have a page with a simple flash animation at the top. When the animation reaches the last frame, I want to change the style sheet for the whole page to a different one. (purpose: to make some previously invisible elements suddenly appear, without a page refresh being necessary).

I have got this far:

The final frame of the animation has this actionscript:

Code:
getURL("javascript:change_style('style2')");

...which was the recommended way of addressing the browser's JavaScript. (I also tried FS_command, which seemed to be less successful)

Then in my HTML header:

Code:
<link id=&quot;style&quot; rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot;>
<script language=&quot;JavaScript&quot; type=&quot; text/javascript&quot;>
   function change_style(style_sheet) {
      document.getElementById('style').href = style_sheet + '.css';
   }
</script>

This works perfectly on my Mac with Safari and Netscape, but not Internet Explorer. Also seems to work on Windoze XP.

I would like to know if this is the best approach? Which platforms/browsers should this work on? How can I hard-wire the second style sheet to the page for any browsers which won't do my function properly?

I am a JavaScript novice I'm afraid. Could I first test if the change_style function will work, and if not, do a document.write to hard-wire the second style sheet to the page?

Thanks for any help!

______________________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top