A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: CSS image change help needed!

Threaded View

  1. #2
    Junior Member
    Join Date
    Nov 2009
    Location
    Utah
    Posts
    4

    Use Server Side Code

    Typically I create this type of capability using a server-side language such as ASP or PHP, but you can't really do it within the CSS file itself. You'd have to put that bit of CSS in each individual file. (go to my site http://www.mohicanwebware.com and view the source to see how some of the CSS is page specific - that is generated by ASP).

    If each page is unique, you could simply put that line of CSS code in the header of each page.

    Finally, the trickiest way to do it would be with JavaScript:
    • Create a CSS class for each page and put them in your CSS file
    • Save your URL to a variable
    • Detect which page you're on
    • Change the class of your Span object with the background image to be the class that corresponds to the current page using a line similar to document.getElementById('YOURSPANID').className = 'NEWCLASSNAME';



    And if none of that works for you, post a link to your website so we can see how your website works and go from there.
    Last edited by sdpetersen; 11-11-2009 at 11:59 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center