Anonymous user
User talk:La Longue Carabine: Difference between revisions
m
→Analyze and Discuss
m (→Analyze and Discuss: Added instructions for putting Spidermonkey code on an HTML page.) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1:
==
Whatever.
== To Use Spidermonkey Examples in HTML Documents ==
1. Create an HTML page like the one below,
Line 11 ⟶ 10:
2. Paste the Spidermonkey script into it,
3. Comment out the
4. Comment out the call to <code>main()</code>,
4. Load into your browser and enjoy!▼
<pre>
Line 22 ⟶ 23:
var printBuf = '';
function putstr() {
for (var i = 0; i < arguments.length; i++) {
printBuf += arguments[i] + pad;
▲ if (arguments.length > 1) printBuf += ' ';
}
}
function print() {
for (var i = 0; i < arguments.length; i++) {
putstr(arguments[i] + pad);
▲ if (arguments[i].length > 1) putstr(' ');
}
var d = document.createElement('div');
Line 39 ⟶ 40:
}
// Put my code here, but remove the hash-bang and call to main
// #!/usr/bin/env js
// ...
//main()
|