View Full Version : Adding a rollover image to a .js file script

01-22-2005, 08:42 AM
Hi, much thanks to anyone who can help me out here!

.. I am building a gallery website to showcase my photography and illustration. All things are going swimmingly, except now I am stuck! :confused:

I am using a js resize script to handle the display of my images on different res settings. It looks wonderful, but I have one image I would like to add a rollover effect to

...is it possible to include something like that in the script shown below? I've been trying to figure out how for the last week, but my grasp on js is not exactly strong

FYI rollover image src=175illustration-hover.png

// JavaScript Document
if (screen.height >= 1024 && screen.width >= 1280) {
document.write("<img src='175illustration.png' border=0>");
else {
if (screen.height >= 768 && screen.width >= 1024) {
document.write("<img src='130illustration.png' border=0>");
else {
document.write("<img src='90illustration.png' border=0>");
// End -->

Mr J
01-22-2005, 03:33 PM
you could try

document.write("<img src='175illustration.png' border=0 onmouseover='this.src=\"175illustration-hover.png
\"' onmouseout='this.src=\"175illustration.png\"'>");

01-23-2005, 08:47 AM
Thank you so much! :thumbsup:

the code worked exactly how i needed it to, now I am officially eternally in your debt!