diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch) | |
tree | 5ac38a06f3dde268dc7927dc155896926aaf7012 /khtml/ecma/jsk.html | |
download | tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khtml/ecma/jsk.html')
-rw-r--r-- | khtml/ecma/jsk.html | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/khtml/ecma/jsk.html b/khtml/ecma/jsk.html new file mode 100644 index 000000000..917c083e8 --- /dev/null +++ b/khtml/ecma/jsk.html @@ -0,0 +1,113 @@ +<html> +<!-- +Javascript Konsole (c) 2001 Till Krech <till@snafu.de> +Dieser Code unterliegt den Bedingungen der Gnu Public License Version 2. +--> +<head> +<title>Javascript Konsole</title> +<style type="text/css"> +code { + color:#444488; +} +em { + font-weight: bold; +} +</style> +<script language="JavaScript"> + +function do_eval() { + var fo = document.forms.fo; + fo.restyp.value = ""; + fo.field.value = ""; + var fo = document.fo; + var expr = fo.zeile.value; + var result = eval(expr); + fo.restyp.value = typeof(result); + var tuedel = ""; + if (typeof(result) == "string") { + tuedel = '"'; + } + fo.field.value = tuedel + result + tuedel; +} + +function do_properties() { + var fo = document.forms.fo; + fo.restyp.value = ""; + fo.field.value = ""; + var fo = document.fo; + var expr = fo.zeile.value; + var result = eval(expr); + var i; + fo.restyp.value = typeof(result); + var fieldvalue = ""; + if (typeof(result) != "undefined") { + for (i in result) { + var tuedel = ""; + var propval = result[i]; + if (typeof(propval) == "string") { + tuedel = '"'; + } + fieldvalue += + i + + " [" + typeof(propval) + "] = " + + tuedel + propval + tuedel + "\n"; + } + fo.field.value = fieldvalue; + } +} + + +</script> +</head> +<body bgcolor="#dddddd"> +<h1>JavaScript Konsole</h1> +<form name="fo"> +<table bgcolor="#cccccc" cellspacing="1" cellpadding="8"> + <tr bgcolor="#ffeeee"><th height="40" align="right">Expression</th><td><input name="zeile" type="text" size="60"></td></tr> + <tr bgcolor="#eeeeee"><th align="right">Result Type</th><td><input name="restyp" readonly type="text" size="60"></td></tr> + <tr bgcolor="#eeeeee"><th align="right">Result(s)</th><td><textarea readonly name="field" rows="10" cols="60"></textarea></td></tr> +<tr bgcolor="#ffeeee"><td> </td><td> + <input type="button" value="list properties" onclick="do_properties()"> + <input type="button" value="evaluate" onclick="do_eval()"> + <input type="reset" value="clear fields" +</td></tr> +</table> +</form> +<h2>Explanation</h2> +<h3>Operation</h3> +<blockquote> +When <em>evaluate</em> is pressed, the given expression is evaluated and the result is displayed in the result(s) field. +In case of <em>list properties</em> being pressed, the result of the expression is taken as an object +and the objects properties are displayed with their type and value in the the result(s) field. +</blockquote> +<h3>Expression</h3> +<blockquote> +Expression must be a valid javascript expression, e.g.<br><code>window</code> +<br>or<br><code>document.body.innerHTML</code><br>or<br> +<code>"Today: " + (new Date()).toString()</code><br> +or<br> +<code>"Cablecar".match(/ab.*c/)</code> +<br>It is also possible to assign a value, +e.g.<br><code>document.getElementsByTagName('H1').item(0).innerText="Hello World"</code><br> +You may execute these examples by pasting them into the expression field. +</blockquote> +<h3>Result Type</h3> +<blockquote> +The type of the result of the given expression. +</blockquote> +<h3>Result(s)</h3> +<blockquote> +The result of the expression is implicitly converted to a primitive type by the javascript interpreter, +if <em>evaluate</em> was pressed. When <em>list properties</em> was pressed, a <code>for (var i in obj)</code> loop +is executed to list the properties. These object properties are in turn evaluated and their types and values +are displayed. +</blockquote> +<p> +<a href="mailto:till@snafu.de?subject=JavaScript%20Konsole">Till Krech</a> +</p> +<p> +<br> +</p> + +</body> +</html> |