Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Problem with my start() function - please help !!

    Hello - please help

    On my website I use js to hide an info box on start up and reveal only on a mouse-over.

    This works fine on some pages - but doesn't on others even though the code is identical because I have put the js functions into an external file which they all refer to.

    Can anyone spot what I have done wrong ?

    The pages are live on :
    http://www.yodbod.com/ad_manager_a.php

    If you just click on the top GO (ie with "Local Services" already selected) you will see that the READ THIS info box is hidden until you roll over it.

    BUT
    if you select "Cars Bikes Boats" section (instead of "Local Services" )
    you see that the info box is visable on loading - and wrecking the page cos no-one will guess that you need to roll on and off the READ THIS label.

    Both pages read the "start" function from the functions1.js file and yet they behave differently - how can this be ?
    - please help

    I also noticed that on the broken one ("Cars Bikes Boats") if you click on continue and look at the "second page" ( actually it is one layer being hidden and another revealed) you then see the "Go back to firstpage" button - this button runs the start() function - but it does not run it properly because the "READ THIS" div is not made visable.

    I don't understand how it can NOT work

    Here is the function file that is used by both pages:

    Code:
    function show_tip1(targetID) { 
        document.getElementById(targetID).style.visibility = "visible"; 
    }  // end of function
    
    function show_part(targetID) { 
        document.getElementById(targetID).style.visibility = "visible"; 
    }  // end of function
    
    function show_tip2(targetID) { 
        document.getElementById(targetID).style.visibility = "visible"; 
    }  // end of function
    
    function show_agent() { 
        document.getElementById('agent').style.visibility = "visible";
    		document.getElementById('layer2').style.visibility = "hidden";		
    }  // end of function
    
    function hide_agent() { 
    		document.getElementById('layer2').style.visibility = "visible";
        document.getElementById('agent').style.visibility = "hidden";	
    }  // end of function
    
    function show_offwant() { 
        document.getElementById('offwant').style.visibility = "visible";
    }  // end of function
    
    function hide_offwant() { 
        document.getElementById('offwant').style.visibility = "hidden";
    }  // end of function
    
    function show_read() { 
        document.getElementById('read').style.visibility = "visible";
    		document.getElementById('layer1').style.visibility = "hidden";
    }  // end of function
    
    function hide_read() { 
        document.getElementById('read').style.visibility = "hidden";
    		document.getElementById('layer1').style.visibility = "visible";
    }  // end of function
    
    function show_layer2(targetID) {
        document.getElementById(targetID).style.visibility = "visible";
        document.getElementById('layer3').style.visibility = "visible";
    		document.getElementById('readThis').style.visibility = "hidden";
    		document.getElementById('theTips1').style.visibility = "hidden";
    		document.getElementById('theTips2').style.visibility = "hidden";
    		document.getElementById('layer1').style.visibility = "hidden";
    		document.getElementById('part').style.visibility = "hidden";  
    		document.getElementById('ow').style.visibility = "hidden";
    }  // end of function
    
    function start(){
    document.getElementById('layer1').style.visibility = "visible";
    document.getElementById('readThis').style.visibility = "visible";
    document.getElementById('layer2').style.visibility = "hidden";
    document.getElementById('layer3').style.visibility = "hidden";
    document.getElementById('theTips1').style.visibility = "hidden";
    document.getElementById('theTips2').style.visibility = "hidden";
    document.getElementById('part').style.visibility = "hidden";
    document.getElementById('agent').style.visibility = "hidden";
    document.getElementById('offwant').style.visibility = "hidden";
    document.getElementById('read').style.visibility = "hidden";
    document.main_fm.x_area_cd.focus()
    }  // end of function
    Thanks
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    you should style the element in the initial markup to be hidden instead of using javascript to do it after the page loads.

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    WOW

    So easy when you know how

    Of course it would be nice to know why the satrt() was working on 4 pages and not the other 3 pages ! - any ideas ?
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.


  •  

    Posting Permissions

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