Click to See Complete Forum and Search --> : Image Object


nickeax
10-25-2003, 08:17 AM
Hello. This is my first post here. It looks like a nice enough forum!!

I have a sleight problem with preloading images. I create a new image object:

var image1 = new Image();

Then I assign an image to that var:

image1.src = theImage.jpg;

I then give a name to an <img> tag and place it into an anchor. Of course whilst testing on my local machine, the mouseover works as expected, nice and crisp. When I test online, it's obvious that the image is not being assigned to the variable... I have tried placing the code in and out of the head tag, with the same results.
I'm using IE on XP pro. Thanks in advance for any advice.

I'm familiar with PHP, C, C++ and a little bit of ASM if anyone needs some help in those areas. Cheers, Nick.

Khalid Ali
10-25-2003, 08:23 AM
since you have shown us partial code,I can only guess that your image is not accessible when you are trying to point to it on line
1. wrong directory/folder
2. image name has speces or invalid chars init.

Assuming there is nothing wrong with your other code

nickeax
10-25-2003, 08:28 AM
Khalid, thanks for the quick reply. The none mouseover image and the mouseover image work fine, but not instantly. If I hover over the button that's meant to trigger the event, eventually the image loads. I can achieve the same effect using the hide attribute in CSS, but it's quite messy with all the positioning and stuff...