Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Global variable doesnt work

 
Sven Bender
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there!

Im currently writing a webapplication with JSF and Javascript. I have a navigation menu on the left which should also be usable by pressing keys like "1" or "a". The menu has 3 entries in the root with 4 subentries each. My Javascript works fine for the root elements, but when it comes to the submenus something goes wrong. If the user pressed for instance "1" which means he will be in the first submenu i want to save this state for later use. What i did is : I declared a variable outside my function var state = 0; inside my code i refer to that variable by state = 1; but for some reason the value of state isnt changed. It remains 0 which makes the rest of my script not working. Below is the whole source of my script. Hopefully someone can help.

Thanks!

[edit- fixed code layout - Eric]
[ May 25, 2005: Message edited by: Eric Pascarello ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, what is this l.onclick(); doing? calling a js function or hitting the server?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic