View Full Version : HV MENU running before all images loaded help?

08-16-2005, 02:51 PM
I feel like an idiot.. I guess thats why i'm here.
I am hoping someone have come across this.
Using the HV menu script from http://www.burmees.nl/menu/menus.htm

1. created my array

<script language="JavaScript" type='text/javascript'>
var ImgArr=['I1','../images/logos/3m.jpg','I2','../images/logos/accor.gif','I3','../images/logos/afn.gif'];

2. Replace the empty function AfterBuild in the variable file with:

function AfterBuild(){
var M_A,M_Al,i;
for (i=0;i<M_Al;i+=2)document.images[M_A[i]].src=M_A[i+1]}}

3. Replace all my images with a dummy image.

<img src="../images/spacer.gif" name="I1" width="206" height="49">
<img src="../images/spacer.gif" name="I2" width="200" height="129">
<img src="../images/spacer.gif" name="I3" width="280" height="104">

what happens is that the menu appears, but doen't replace the dummy images with the real one.

Please help. I have even saved a working version from the site and tried to disect it with no success.

thanking in advance.

08-16-2005, 05:20 PM
The code looks reasonable but, window.ImgArr might not be available to your function or, for some reason, it might not be getting called. Easiest way to test that is:

function AfterBuild(){
alert('AfterBuild Called')
var M_A,M_Al,i;
for (i=0;i<M_Al;i+=2)document.images[M_A[i]].src=M_A[i+1]}}If both alerts fire, and the second one displays all the contents of ImgArr, then the code is firing and the array is available. If not, we will have to work on one or the other of those issues. Easiest way for me to trouble shoot something like this is to have a link to it.


08-17-2005, 02:45 AM
thanks for your advise,
after a relaxing break watching Australian Idle I found what the problem was.
I got over 58 images to add into the array. I managed to miss out a few images with the close single quote.
working backward I removed each ten images to see if it worked and if it didn't I narrowed down the error.

thanks, so the script does work