Prev | Current Page 729 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


var window : Window Is a reference to the Window object in a DOM tree.
var isIE : Bool Returns true if the current browser is Internet
Explorer.
var isOpera : Bool Returns true if the current browser is Opera.
392
Part II: Server Side, JavaScript, and Flash: Oh My!
Although the Lib class provides the isIE and isOpera variables, it is often a better practice to test
the browser for the needed feature and not rely on the detected name of the agent.
Redirecting Errors to a Custom Function
In the following example, the execution errors are redirected to a custom function that simply traces the
error messages and does not break the code execution. Avoiding the errors in this way is not really a
good practice; changing the return value to false , the execution is stopped and the browser reports an
error to the user.
class Main
{
public static function main()
{
js.Lib.setErrorHandler(function(msg, arr)
{
trace(msg + ???, ??? + Std.string(arr));
return true;
});
throw ???Error!???;
}
}
HTML DOM
The Document Object Model (DOM) is a language - independent representation of an HTML/XML
document.


Pages:
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741