So I have been working on my website so I can get a job and ya know, market myself out there. Just wondering if any of you guys know of a code that would let me put a picture on the front page (index) and whenever someone refreshes the page a new picture of mine would pop up every time. Of course it would be getting the pictures from a folder I designate it to.
So if anyone would please help me out or point me in the right direction as to where I could get this I'd really appreciate it.
Posts
http://www.google.com/search?hl=en&q=javascript+random+image+rotator
Why?
when posting questions reguarding code, please post the code or a link to a live version. otherwise, we cannot guess what is going on. there is no one way of doing what you want, and some methods/scripts may work better or worse than others.
here is one that I copied from somewhere and saved long ago:
just stick that into whatever container you're using to align the images
that's why we call it the struggle, you're supposed to sweat
I've put together a one-off script for you to use. (ImageRotator.js)
Your HTML would look something like this (validated HTML with W3C):
When you need to add images or remove images, simply add/remove lines from the javascript file. Extracting the javascript to an external file will allow the client to cache the file saving you bandwidth (every little bit counts) - the JS file has already been fairly minified. You can also rotate multiple images with this solution by using additional randomImage(...) function calls targeting other image tags. If the user has a browser that has JavaScript disabled (which is unlikely), you at least show the first image on your page.
OK so this picture is the index of my site. The red highlighted box is where I want images to be and rotate whenever someone visits my site and refreshes or just enters the page.
NOW If I understand coding for websites correctly in which I have no idea what im doing. I should replace with the code people posted a couple of days ago.
Also note that I have been fiddling with other peoples method of doing this and so far its not working. And I really have no idea how to code. Did this all with Fireworks and Dreamweaver.
This should be basically what you are looking for. On mouse over of the buttons on the left, you can select a new image, and when you load the page, a random selection from the javascript specified will be displayed.
Simply replace the sample URLs and Image names with the appropriate names from the files you have created. So "YourImageHere.jpg" would be "HomeButton.jpg" or whatever.
As for learning HTML, it's actually very easy. Javascript can throw you for a loop, but basic HTML is very easy to pick up and learn, and isn't really even programming - it's just markup. Visit w3schools to learn all the basics.
As for the code I don't think thats what I am looking for. I just want different images to appear in that box each time someone visits the page. Not when they mouse over the left side buttons. (I believe I understood it that way. And if not I apologize and use this helpful code.)
They use Dreamweaver to teach web design these days? Ugh... get yourself over to http://www.w3schools.com/html/DEFAULT.asp, download NotePad++, and start learning real HTML and CSS.
just don't let it write any code for you
that's why we call it the struggle, you're supposed to sweat
I take it you are an artist, and sometimes you get a little exchange going where you slip them 40 bucks, they fix your site, and they get to list you on their work examples.
That's the easy way. I know from sitting in on student portfolio classes that graphic artists of the non-web sort really don't want to be bothered with code.
Other than that... perhaps check out flashden.net and you might get lucky and find an image rotater for free.
we also talk about other random shit and clown upon each other
Any would be web design student should start with HTML and CSS in NotePad++. Dreamweaver can't account for all the inconsistencies between browsers and how CSS is implemented.
we also talk about other random shit and clown upon each other
Yah, this should do what you want it to do. I apologize if I am assuming too much experience on your part - it sounds like you are just at the intro level and I've been at this for years =D
I've color coded what should be replaced to help you understand. The button mouseovers and the image rotator are completely separate. You don't mouseover the buttons to get the image to change - that's what the rotateImage function does, and that is called onload in the 'body' tag.
DarkSlateGray - Page Title
Lime - For each image you want to rotate, simply copy and add a line like the ones shown here.
MediumTurquoise - Replace these with the links to your other pages.
Purple - Place the url to the button images here (the initial state, when they are not being moused over).
Yellow - Place the url to the button mouseover images here.
Red - Place the first image url from your set here, so if the user has JavaScript disabled, at least you show them an image instead of nothing.
DarkOrange - This is what loads a random image and displays it. Nothing else.
Awwww, now I feel a bit offended. I understood what to replace with what and understood what those meant.
8-)
we also talk about other random shit and clown upon each other
Anyway... buh bye now and forever.