Prev | Current Page 68 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

htm , open it with your text editor, and enter the
following code:
< html >
< head >
< title > Hello World < /title >
< /head >
< body >
< span id=???haxe:trace??? > < /span >
< script type=???text/javascript??? src=???helloworld.js??? > < /script >
< /body >
< /html >
Now save the file in the application directory and open it in a web browser. You should now see the
usual output in much the same way as when you called the Neko file with a browser.
Although the Neko and JavaScript examples look similar, they are actually quite different. In the
Neko example, the Hello World! string was displayed statically in the browser, whereas in the new
JavaScript example, the span tag in your HTML file acted as a container that provided the JavaScript
code with a point in which to enter the Hello World! string.
To prove this point, reopen the HTML file and place the span tag after the line that loads the
helloworld.js file. Now save and run the HTML file. If you did this correctly, the browser should now
be empty and the dialog shown in Figure 2 - 5 is displayed.


Pages:
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80