![]() |
| ||
| Alternating backgrounds? 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: |
| ||
| 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? |
| ||
| 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? |
| ||
| 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? |
| ||
| 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. |
| ||
| Re: Alternating backgrounds? It depends. The easiest way is with server-side code. You can't do it with plain HTML. |
| ||
| Re: Alternating backgrounds? alright, ill do it server side code |
| ||
| 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: <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. |
| ||
| Re: Alternating backgrounds? no reason why you couldn't do this with javascript, Math.random and the window onload event. |
| ||
| 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! |
| All times are GMT -4. The time now is 8:45 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC