The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Change BG Image, change bg img with three buttons
hungrychapstick
post Feb 3 2012, 11:36 AM
Post #1





Group: Members
Posts: 3
Joined: 3-February 12
Member No.: 16,386



Hello! Thank you for your time.

My problem is, I would like to be able to change the background image of my webpage with three different buttons- each changing the background to something different (obviously).

I'm not sure if this question belongs here.. (I think it does). This is such a newbie question, I know.

I tried a variety of different things with javascript and stylesheets, and a few times I almost had it. I am new to this, so any help would be much appreciated!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hungrychapstick
post Feb 3 2012, 12:10 PM
Post #2





Group: Members
Posts: 3
Joined: 3-February 12
Member No.: 16,386



Alright! I figured it out! Thanks for viewing, anyway. Dx

(Is there a way to close this thread??)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 3 2012, 12:36 PM
Post #3


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



How did you solve it?

Normally we don't close threads in this forum...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hungrychapstick
post Feb 3 2012, 12:58 PM
Post #4





Group: Members
Posts: 3
Joined: 3-February 12
Member No.: 16,386



QUOTE(Christian J @ Feb 3 2012, 12:36 PM) *

How did you solve it?

Normally we don't close threads in this forum...



CODE

<html>
<head>
<title>Jake's Backgrounds</title>
</head>

<body style="background-image:url(original.jpg)">
<h1>Change the Background!</h1>

<form>
<input type="button" name="button" value="Clover" onclick="document.body.style.backgroundImage = 'url(clover5.jpg)';" />

<input type="button" name="button" value="Metal" onclick="document.body.style.backgroundImage = 'url(metal4.jpg)';" />

<input type="button" name="button" value="Rainbow" onclick="document.body.style.backgroundImage = 'url(rainbow3.jpg)';" />
</form>
</body>
</html>


It was... actually simple. Dx I was making it VERY difficult. Ugh.
And, I see. Well.. I'm sorry this thread will sit here, then! D:
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th April 2024 - 09:53 PM