Sunday, November 21, 2010
Something I learn from audit
When auditing a subject, the first thing I want to know is who have ownership of it. I have done a hardware and software inventory audit for my institution and while I identified many exceptions, there were no departments that claim ownership and management of inventory. I ended up chasing tail over and over and wasted precious time reviewing many systems that had inventory information but does not serve as the official collection of inventory maintained for the institution. Therefore, identifying the ownership of a subject should be one of the first thing to seek for.
Saturday, November 20, 2010
Javascript alert can execute code?
I don't know if this has been talked about, but it looks like the alert statement does more than display the content within the (). It is possible to execute code within the alert statement.
normal use of alert would be:
window.alert('hello world');
alert(1);
executing code:
alert(function() { for(var i = 0; i < 3; i++) alert (i); } ())
The behavior seems to be it executes the code within the outter alert, display 0, 1, 2 in msgbox, and then follow by undefined, which is the alert statement displaying undefined.
I always thought alert will only display "text", or a variable's content.
I would have expected a javascript error from the above statement, but it did not. Can anyone share why this behavior exists?
the above statement works in both IE and FireFox.
normal use of alert would be:
window.alert('hello world');
alert(1);
executing code:
alert(function() { for(var i = 0; i < 3; i++) alert (i); } ())
The behavior seems to be it executes the code within the outter alert, display 0, 1, 2 in msgbox, and then follow by undefined, which is the alert statement displaying undefined.
I always thought alert will only display "text", or a variable's content.
I would have expected a javascript error from the above statement, but it did not. Can anyone share why this behavior exists?
the above statement works in both IE and FireFox.
Subscribe to:
Posts (Atom)