See "About This JavaScript Site" in JavaScript Index and Introduction.
Please do not use this actual Web page repeatedly. If you like it, or parts of it, make your own private page on your private local system, including only what is essential. This page is copyright, and must not be re-published; but you are free to re-implement its concepts. No include files are used; CSS is optional.
This page can be read completely with scripting disabled. But, to get any of the buttons to operate as intended, JavaScript must be enabled. To operate usefully, the VBS button also requires VBScript.
"Eval" uses the JavaScript "eval" routine indirectly. Put JavaScript code in the big box, press the button, and see the final result below. The button definition includes onClick="this.form.Result.value=remoteEval_(this.form.Code.value)"
"NewW" uses the JavaScript "eval" routine indirectly. Put JavaScript code using document.write[ln] in the big box, press the button, and see the final result in a new window.
"HTML" uses the "document.write" method. Put HTML code in the big box, press the button, and see the result on a new page. The button definition includes onClick="document.write(this.form.Code.value)"
"VBS" is as HTML, but adds tags for VBScript.
"Pack" packs text paragraphs to the indicated right margin.
"Indt" indents JavaScript (ECMAScript 3; possibly unsafe for later versions) by two spaces per unclosed { } and for some continuing statements.
"Demo" loads trivial examples for "Eval".
"+" & "-" alter textarea height (the width fills the window).
Ignore any "?" button completely.
Variable F has been set to refer to the blue Form.
Give in the textarea a JavaScript expression, or expressions, to
evaluate; the Result of the last will be shown (for multiple answers,
evaluate an array, e.g. r = [x, y, z]).
e.g. Bard =
"04/23/1564".replace(/(\d\d).(\d\d).(\d\d\d\d)/, "$3-$1-$2")
or S = "ab6cd@e.f" ; /^.+@.+\..+$/.test(S) to
test an E-address with a RegExp
or +F.X2.value + +F.X3.value to do 2+3, etc.
or F.Code.rows=5 ; F.Code.cols=45 to
re-size the box.
If code includes document.write[ln] a new page is written; try Back and View Source.
For the final expression to return a Result, it should start with neither var nor a literal RegExp or Array; instead, use such as X = ....
Avoid variable names that might refer to existing objects, fields, or variables, except to refer to those items. To see why not, try Eval of F.Code.value="" or document.forms["F"].Code.value="" or F.Eval.value=88. Names ending with underline are reserved.
Give some code using document.write().
Give in the textarea an argument for document.write().
Give VBScript in the textarea, using document.write or other means of observing the effect.
Give text in the textarea. Paragraphs are separated by blank lines. Pack may assume DOS line-ends.
Give ES3 script in the textarea.
This loads simple demo code, for "Eval", to the textarea. Press again to change demo. Demo 6 is for testing code speed; put the codes to be compared within two of the {} provided.
Twelve controls below are
F.Code, F.Eval, F.NewW, F.Html, F.Vbs, F.Pack, F.Len, F.Indt,
F.Load, F.Bigr, F.Smlr, F.Result.
For example, to alter the number of rows, enter F.Code.rows = 5
and press the Eval button.
Try document.body.style.backgroundColor = "lime" ; and
document.write(document.body.innerHTML) ;
and document.body.style.font="normal normal medium Papyrus" ;
and F.X0.disabled ^= 1 .
JavaScript Include Files are no longer used by this page, but JavaScript Demos still has them.