heero11yuy Posted September 21, 2006 Share Posted September 21, 2006 JS problem with "alert", please lend a hand~The following is the code, very simple: status = getstatus(); alert(status); if ( status != "playing"){ ... } else{ ... }When I put the line "alert(status);" into the code, it works & ENTERS into the "if ( status != "playing")" statement, that's what I want...But when I take away the line "alert(status);" from the code, it doesn't work and doesn't enter into the if statement... that means status == "playing" ... getstatus() isn't called? isn't updated? or status isn't written into the correct form for comparing with "playing"? I needa know what alert() does there which creates a bug there... please help~! Urgent Link to comment Share on other sites More sharing options...
Webworldx Posted September 21, 2006 Share Posted September 21, 2006 Doesn't seem to be anything wrong with that snippet... i've extended it a bit just to show it does work without the alert: <script>function getstatus(){ return "playing";}var status = getstatus();if ( status != "playing"){ alert('not playing');} else{ alert('is playing');}</script> Runs fine and displays the correct result. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now