5 replies [Last post]
SpencerK
SpencerK's picture
Offline
newbie
Last seen: 14 years 33 weeks ago
Joined: 2006-02-23
Posts: 6
Points: 0

Hey there folks.

I'm not totally confidant with CSS, and thus not sure if this is possible. I have run a search and cannot find anything regarding the changing of backrounds with a button. Have seen changing colours, but not backgrounds. Maybe if I was more informed about CSS then I could adapt the code.

At the moment I'm using;

function changeBGImage(image){
document.body.background=image;
}

<a href="/javascript:changeBGImage('background/Darkgrey.jpg')" rel="nofollow"><img src="/background/BtnDarkgrey.jpg" border="0" width="42" height="28"></a>

You can see the attempt down the left hand side in the box with colours on it, heh, I know they appear dark at the moment, I'm still designing the page. www.wowoneguild.com

Obviously, the problem here is when someone goes to another page, the background will go back to the default. I can rectify this by implementing cookies, but this site does not call for that.

So I would like to be able to change backgrounds using CSS file, although, I really have not got a clue on how to do it, as Im using CSS for text etc... So I need seperate files for the background... Thank you for any and all help here, and if this has been covered before, but I missed the post, then send me in the right direction.

Thank you very much indeed.

Desdinova
Desdinova's picture
Offline
Enthusiast
Last seen: 9 years 2 days ago
Timezone: GMT+1
Joined: 2006-03-28
Posts: 341
Points: 4

that's a pretty funky trick.

that's a pretty funky trick. I don't think it's doable without cookies or session variables.

As a rule, I never touch anything more sophisticated and delicate than myself

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 4 days 16 hours ago
Joined: 2004-06-30
Posts: 9679
Points: 815

You'll need cookies to

You'll need cookies to remember which style the user has selected Wink

Google for "style sheet switcher", I think there's an article at Malarkey's website that should go through it all in detail.

Verschwindende wrote:
  • CSS doesn't make pies

SpencerK
SpencerK's picture
Offline
newbie
Last seen: 14 years 33 weeks ago
Joined: 2006-02-23
Posts: 6
Points: 0

Thank you very much indeed

Thank you very much indeed pineapple dude;

Found this.

Good day to you my fruit flavoured friend.

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 4 days 16 hours ago
Joined: 2004-06-30
Posts: 9679
Points: 815

I was referring to

I was referring to this:

http://www.stuffandnonsense.co.uk/archives/iotbs_version_21.html

but it's all good Wink

Verschwindende wrote:
  • CSS doesn't make pies

3point
Offline
newbie
England
Last seen: 14 years 31 weeks ago
England
Timezone: GMT+1
Joined: 2007-04-17
Posts: 2
Points: 0

Both links

Yo,

i had a look at both links. The one that Spencer found seemed pretty good to me, especially because there were different user interfaces for changing stylee sheets. Not so gret for type sizes, i'd make buttons with proposed size on each, but for styles / themes the drop down was quite smart and space saving.

I guees that you can apply that menu to other scripts as well.

What's the difference between the two? I can't read java so wouldn't be able to tell.

The options on spencer' seemed pretty good in the way that you could specify how long the cokies would last, random switching of styles etc.

good bike, 3point