View Single Post
Old 01-31-2013, 10:01 PM   PM User | #5
scnerd
New to the CF scene

 
Join Date: Jan 2013
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
scnerd is an unknown quantity at this point
Quote:
Originally Posted by Airblader View Post
Which indicates that you get an error, for example something is undefined. Use the console to verify what happens.
Right, I got that there was an error, but I'm literally running the code above. Besides the conditions and the "alert" calls, I'm actually doing nothing (everything else is commented out), and the behavior is the same. When the condition is met, everything runs, else nothing is run. So my question is more: is there any reason why that first condition being false should mean that the rest of the code doesn't run?

Here, for reference, I am running this *exact* code (this is the entire script):
Code:
var msg = document.body.innerHTML;

if(msg.match(/Big monster/gi).length > 0)
   {
   alert("attack");
   //Do stuff
   }
else
   {
   alert("not attack");
   //Do other stuff
   }
And the behavior is as I said above. Either "attack" gets displayed, or nothing does.
scnerd is offline   Reply With Quote