...

View Full Version : Undefined variable error, even though variable is defined



Staggan
08-24-2010, 11:43 AM
Hello

I have a php page in which I declared a js variable... right at the top of the page...

<script type="text/javascript">
var tester = 0;
</script>


Later in the page I test this variable...

<script type="text/javascript">

if (tester==1){

do some stuff!!
}

</script>

But I keep getting an error variable _tester undefined


Am I missing something obvious... I am new to js... but this seems really straightforward

abduraooft
08-24-2010, 12:24 PM
Could you post the complete code taken from browser's view-source option?

Old Pedant
08-24-2010, 11:33 PM
I keep getting an error variable _tester undefined

???? You define a variable named "tester" but I don't see you defining a variable name "_tester".



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum