Results 1 to 3 of 3

Thread: HV MENU running before all images loaded help?

  1. #1
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HV MENU running before all images loaded help?

    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'];
    </script>


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

    function AfterBuild(){
    var M_A,M_Al,i;
    if(typeof(window.ImgArr)!='undefined'){
    M_A=window.ImgArr;M_Al=M_A.length;
    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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,957
    Thanks
    43
    Thanked 3,195 Times in 3,157 Posts
    Blog Entries
    12

    Default

    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:
    Code:
    function AfterBuild(){
    alert('AfterBuild Called')
    var M_A,M_Al,i;
    if(typeof(window.ImgArr)!='undefined'){
    alert(window.ImgArr)
    M_A=window.ImgArr;M_Al=M_A.length;
    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.

    PLEASE: Include the URL to your problematic webpage that you want help with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •