| | |
Alternating backgrounds?
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2005
Posts: 4
Reputation:
Solved Threads: 0
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:
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?
•
•
Join Date: Jul 2005
Posts: 4
Reputation:
Solved Threads: 0
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?
reload the page and see how the background image always changes.
I would i do that?
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
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:
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.
So to generate an alternate image, you might have something that looks like:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<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.
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
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!
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: javascript validation
- Next Thread: DateTime - TimeZone conversion with Javascript. Partially working!
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser bug captchaformproblem cart checkbox child class close codes createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming progressbar prototype redirect runtime safari scale scriptlets scroll search security shopping size software toggle unicode w3c web wysiwyg \n







