Alternating backgrounds?

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jul 2005
Posts: 4
Reputation: BT2005 is an unknown quantity at this point 
Solved Threads: 0
BT2005 BT2005 is offline Offline
Newbie Poster

Alternating backgrounds?

 
0
  #1
Jul 27th, 2005
hey all, i was wondering if anyone has the code for "Alternating backgrounds", i dont know if that is the term for it, but its where you load a page, and the background is differnt everytime you load that page, do you follow?, well im very new to html and all that, so please dont flip out if i used the wrong words and such :cheesy:
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,040
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 127
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Alternating backgrounds?

 
0
  #2
Jul 27th, 2005
Well, suppose you had an HTML table ... you would just tell one row to be one color and the next row to be a different color. Are you talking more along the lines of a dynamic script that generates content on-the-fly?
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4
Reputation: BT2005 is an unknown quantity at this point 
Solved Threads: 0
BT2005 BT2005 is offline Offline
Newbie Poster

Re: Alternating backgrounds?

 
0
  #3
Jul 27th, 2005
i wanted some thing like this, http://pegase.foxalpha.com/

reload the page and see how the background image always changes.

I would i do that?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Alternating backgrounds?

 
0
  #4
Jul 27th, 2005
You can do this a variety of ways. To give you the best answer, we need to know more about you and your capabilities.

For example, do you do any server-side coding at all? PHP, for example? Or do you want to do this all with client-side code?
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4
Reputation: BT2005 is an unknown quantity at this point 
Solved Threads: 0
BT2005 BT2005 is offline Offline
Newbie Poster

Re: Alternating backgrounds?

 
0
  #5
Jul 27th, 2005
well as i said before, im pretty new, i am good with html and can understand most of it, if you could post the easiest way to do this, then ill give it a shot, I greatly appreciate it.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Alternating backgrounds?

 
0
  #6
Jul 27th, 2005
It depends. The easiest way is with server-side code. You can't do it with plain HTML.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4
Reputation: BT2005 is an unknown quantity at this point 
Solved Threads: 0
BT2005 BT2005 is offline Offline
Newbie Poster

Re: Alternating backgrounds?

 
0
  #7
Jul 27th, 2005
alright, ill do it server side code
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Alternating backgrounds?

 
0
  #8
Jul 27th, 2005
Great! Then I suggest you ask the question in the appropriate server-side coding forum. If you're new to it, then I suggest PHP. PHP works by interspersing PHP tags with your HTML tags. When a user browses to a PHP page, the server first interprets the PHP.

So to generate an alternate image, you might have something that looks like:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <img src="<?php $myVariableImage ?>">

The trick, then, is to write PHP code that changes the value of the $myVariableImage string. So, armed with that little bit of foreknowledge, I suggest you go to the PHP forum and ask some questions there.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: Alternating backgrounds?

 
0
  #9
Jul 27th, 2005
no reason why you couldn't do this with javascript, Math.random and the window onload event.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Alternating backgrounds?

 
0
  #10
Jul 27th, 2005
Yes, that's a client-side approach. You'd have to pre-load graphics. I think the server-side approach is more straightforward. And, as the O.P. was new to web development, I thought he should be exposed to server-side coding. But the thread would benefit from seeing a JavaScript code snippet, if you'd care to post one!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC