Web Hosting Talk







View Full Version : Quick Question about Javascript variables


beet
07-15-2004, 06:13 PM
Hi,

I'm at work and cant test this out, so maybe someone can let me know if this will work:

<script language=javascript>

variable x = 0;

</script>

Bunch of HTML.

<script language=javascript>

x++;

if (x == 2)

output "blah."

</script>

<script language=javascript>

x++;

if (x == 2)

output "blah." ---> This will be displayed.

</script>


Will that work? I dont know if the variables are preserved throughout the page like PHP would for example.