943,937 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jul 27th, 2005
0

Alternating backgrounds?

Expand Post »
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:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BT2005 is offline Offline
4 posts
since Jul 2005
Jul 27th, 2005
0

Re: Alternating backgrounds?

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?
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Jul 27th, 2005
0

Re: Alternating backgrounds?

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BT2005 is offline Offline
4 posts
since Jul 2005
Jul 27th, 2005
0

Re: Alternating backgrounds?

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?
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Jul 27th, 2005
0

Re: Alternating backgrounds?

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BT2005 is offline Offline
4 posts
since Jul 2005
Jul 27th, 2005
0

Re: Alternating backgrounds?

It depends. The easiest way is with server-side code. You can't do it with plain HTML.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Jul 27th, 2005
0

Re: Alternating backgrounds?

alright, ill do it server side code
Reputation Points: 10
Solved Threads: 0
Newbie Poster
BT2005 is offline Offline
4 posts
since Jul 2005
Jul 27th, 2005
0

Re: Alternating backgrounds?

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.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Jul 27th, 2005
0

Re: Alternating backgrounds?

no reason why you couldn't do this with javascript, Math.random and the window onload event.
Reputation Points: 20
Solved Threads: 5
Junior Poster
alpha_foobar is offline Offline
182 posts
since May 2005
Jul 27th, 2005
0

Re: Alternating backgrounds?

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!
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: javascript validation
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: DateTime - TimeZone conversion with Javascript. Partially working!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC