Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    changing CSS from within an external js-file

    Hello!

    I need to change a CSS-Style (background-Image) from within a JavaScript-File.
    Normally I would use >> document.getElementById('headBox').style.backgroundImage='url(bg_pics/01.jpg)'; <<
    But because t

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Looks like your message got cutoff there...

    Sadiq.

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh no. f***!
    okay, but the main information is there.
    However: I'll try again:

    I have a JS-function within a HTML-File, that changes the bg-Image of the headBox and I have a JS-Menu.
    Now I want to have the bg-Image changed on every click in the menu.

    Possibility (1): I find a way to speak to the headBox from the outer JS-File.
    Possibility (2): I call up the function (that changes the bg-Image) in the HTML-File from somewhere else (maybe the easier way). From the Menu-JS-File or the linked HTML-File.

    Hope this was understandable...

    thanks a lot,
    martin

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Possibility 2 sounds good.

    Unfortunately we couldn't help too much as we haven't seen the menu, the html, or any code really. Post some of that perhaps and we'll try and give you a hand.

    Sadiq.

  • #5
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Links

    yeah. sure.
    I got them in my opening post. Okay, here are some links:

    To the testpage:
    http://www.apotheke-globus.de/click-...k-through.html
    (in the header, there is the 'change_bgpic' function)
    The CSS-File is called 'screen.css' and is located in the same directory.

    I used a TopNav III * JS - Navigation Bar by Brothercake (http://www.brothercake.com/dropdown/...II/custom.html)
    To the menu:
    http://www.apotheke-globus.de/click-...menu/custom.js
    (the Menu-Items are at the very bottom of the document)

    The funcion shall now be loaded on every click on any nav-button or maybe it can be loaded with an onLoad-function from the linked file.

    Hope this helps you to help me...
    Thanks already!

    regards,
    martin


  •  

    Posting Permissions

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