...

View Full Version : Problem with my start() function - please help !!



jeddi
11-02-2006, 05:26 AM
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 ? :confused:
- 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 :confused: :confused:

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



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

Beagle
11-02-2006, 06:43 AM
you should style the element in the initial markup to be hidden instead of using javascript to do it after the page loads.

jeddi
11-02-2006, 09:56 AM
WOW :thumbsup:

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 ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum