I am trying to avoid using iframes on the site I'm building because of some crossbrowser issues.
Anyhow I'm trying to display a random image everytime the page is loaded, but also give the user the option to manually change the image.
I don't write javascript code, but am a eager copy paster. I was hoping for help modifying a script slightly, so it allows the user to simply change the image by the click of a buttom (as well), -as opposed to refreshing the entire page (which is a pain for dail-up users). My problem is I don't know how I do that and still keep the randomization code. I would be greatful for help.
code is as follows:
<!--
// ***********************************************
// AUTHOR: LLC
// URL: // Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( )
// ***********************************************
function image() {
};
image = new image();
number = 0;
// imageArray
image[number++] = "<img src='images/indexpic1.jpg' border='0'>"
image[number++] = "<img src='images/indexpic2.jpg' border='0'>"
image[number++] = "<img src='images/indexpic3.jpg' border='0'>"
image[number++] = "<img src='images/indexpic4.jpg' border='0'>"
image[number++] = "<img src='images/indexpic5.jpg' border='0'>"
image[number++] = "<img src='images/indexpic6.jpg' border='0'>"
image[number++] = "<img src='images/indexpic7.jpg' border='0'>"
image[number++] = "<img src='images/indexpic8.jpg' border='0'>"
// keep adding items here...
increment = Math.floor(Math.random() * number);
document.write(image[increment]);
//-->
Thanks
Karina
Anyhow I'm trying to display a random image everytime the page is loaded, but also give the user the option to manually change the image.
I don't write javascript code, but am a eager copy paster. I was hoping for help modifying a script slightly, so it allows the user to simply change the image by the click of a buttom (as well), -as opposed to refreshing the entire page (which is a pain for dail-up users). My problem is I don't know how I do that and still keep the randomization code. I would be greatful for help.
code is as follows:
<!--
// ***********************************************
// AUTHOR: LLC
// URL: // Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( )
// ***********************************************
function image() {
};
image = new image();
number = 0;
// imageArray
image[number++] = "<img src='images/indexpic1.jpg' border='0'>"
image[number++] = "<img src='images/indexpic2.jpg' border='0'>"
image[number++] = "<img src='images/indexpic3.jpg' border='0'>"
image[number++] = "<img src='images/indexpic4.jpg' border='0'>"
image[number++] = "<img src='images/indexpic5.jpg' border='0'>"
image[number++] = "<img src='images/indexpic6.jpg' border='0'>"
image[number++] = "<img src='images/indexpic7.jpg' border='0'>"
image[number++] = "<img src='images/indexpic8.jpg' border='0'>"
// keep adding items here...
increment = Math.floor(Math.random() * number);
document.write(image[increment]);
//-->
Thanks
Karina