SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : HTML and CSS :

Previous DiscussionNext Discussion
 How do i change the background image dynamically?

I already know how to change the background color dynamically or by clicking buttons:

(it's something like this)

<FORM name="changeColor">
<FONT face="Arial" size="2">Choose a Background Color:
<INPUT type="button" onClick="document.bgColor='#0000FF'"
name="colr" value=" BLUE ">
<INPUT type="button" onClick="document.bgColor='#FF0000'"
name="colr" value=" RED ">
<INPUT type="button" onClick="document.bgColor='#00FF00'"
name="colr" value=" GREEN ">
<INPUT type="button" onClick="document.bgColor='#FFFFFF'"
name="colr" value=" WHITE ">
<INPUT type="button" onClick="document.bgColor='#000000'"
name="colr" value=" BLACK ">
</FONT>
</FORM>

i was given this code but...

i really wanted to change the background image and not the color because it's just too plain. i am not really into using css beacause this is only a school project and i am just a student but if anyone could help on this, please, i really want it badly.

P.S. i am using frames on this, it doesnt look good if only one frame changes background so if you could do some piece of advice on that, our teacher requires us to use frames so i dont really have a choice. 

Started By nhikee0725 on Dec 29, 2009 at 1:47:33 AM

8 Response(s) | Reply

Earlier Replies | Replies 5 to 8 of 8 | Later Replies
Goto Page: 2 1
Monte on Dec 29, 2009 at 4:44:18 AM (# 5)

So, you want us to do your homework for you?

I'm sure you'll find your answer with CSS or the JavaScript DOM.

Google: change image background dynamically


nhikee0725 on Dec 29, 2009 at 7:01:35 PM (# 6)

well, not the whole work really,, but thanks, i'll try doing that


nhikee0725 on Dec 29, 2009 at 7:18:27 PM (# 7)

ok, so i've got the code already, just want to share it...

eg.

<INPUT type="button" onClick="document.body.background='bg.jpg'"
name="colr" value=" WHITE ">
<INPUT type="button" onClick="document.body.background='bg1.jpg'"
name="colr" value=" BLACK " target="main">

 

so, on my example on the original text it is >> onClick="document.bgColor='#000000'"

then, you just change it to something like this >> onClick="document.body.background='bg.jpg'"

 

just incase this can help others. :)


Monte on Dec 30, 2009 at 4:11:13 AM (# 8)
This message has been edited.

Great!

I'm glad you found the solution. And, that you had the courtesy to come back and share that solution.

Congratulations! Keep it up!

By the way...why is your teacher requiring you to use frames?

Did the teacher specify a specific size? If not, why not just use a zero-sized frame? It wouldn't technically be cheating...


Earlier Replies | Replies 5 to 8 of 8 | Later Replies
Goto Page: 2 1

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2004 InsideDHTML.com, LLC. All rights reserved.