Cyprus Property - Free Advertising - Image Hosting - Internet Advertising - Debt Consolidation

PDA

View Full Version : Function not defined error


Arnold9000
Feb 11th 2007, 9:51 am
I get a function not defined error in my firefox javascript console and I can't figure out why. Here's the javascript

<script src="findDOM.js"></script>
<script language="javascript">

var hideit="true";
var hideit2="true";

function swap_visibility(objID, cellid){
alert("not working");
var domcell = findDOM(cellid, 1);
domcell.className = "navbright";
alert("line 3");
var domobj = findDOM(objID, 1);
domobj.visibility = "visible";


}

function reset_visible(objID, cellid){
var domcell = findDOM(cellid, 1);
domcell.className='nav';
var dom = findDOM(objID, 1);
if (hideit == "true"){
dom.visibility = "hidden";
hideit = "true";
)
}

</script>


Here's the calling HTML

<td class="nav" id="ddcell" onMouseover="swap_visibility('DrunkDriving', 'ddcell'); return true;" onMouseout="reset_visible('DrunkDriving', 'ddcell'); return true;">DrunkDriving</td>

Pretty simple right? So why doesn't it think that neither "swap_visibility" nor "reset_visible" are not found? I must be blind. Thanks in advance.

MattD
Feb 11th 2007, 10:58 am
Have you put all of this code in the <head>?

Arnold9000
Feb 11th 2007, 12:53 pm
Yes, good thought. But what you see is in the head tag (obviously aside from the calling html). I'm really stumped, and it's going to end up being something stupid :)

phper
Feb 11th 2007, 4:15 pm
Is there any more error messages above that? If the function is there but the error message says otherwise, most probably there is a syntax error somewhere which causes the function definition not loaded by the JS engine.

Arnold9000
Feb 11th 2007, 5:13 pm
The Javascript console only gives me what I mentioned. It's gotta' be something really stupid where a second pair of eyes will catch it

webisfun
Feb 11th 2007, 5:41 pm
well, you were right on something ... it was really stupid,

it's a )
instead of a }

that closes the if { of your last function (see the line before the last } )

Have a nice day

Arnold9000
Feb 15th 2007, 7:58 am
Yep, that was it. Thanks. I knew a second pair of eyes would find it.