| | |
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 ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox close codes css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position programming prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c window windowofwords windowsxp wysiwyg \n







