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

08-24-2010, 11:43 AM

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;

Later in the page I test this variable...

<script type="text/javascript">

if (tester==1){

do some stuff!!


But I keep getting an error variable _tester undefined

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

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".