| 1 |
<!-- http://jibbering.com/2002/4/httprequest.html -->
|
| 2 |
<html>
|
| 3 |
<head><title>CDuce demo</title></head>
|
| 4 |
<body>
|
| 5 |
|
| 6 |
<h1><a href="http://www.cduce.org/">CDuce</a> online demo</h1>
|
| 7 |
<table width="100%" border="1">
|
| 8 |
<tr>
|
| 9 |
<td width="50%" valign="top">
|
| 10 |
<input type="submit" value="Evaluate" onclick="submit('a');"/>
|
| 11 |
<input type="button" value="Clear" onclick="clearreq('a');"/>
|
| 12 |
<textarea id="areq" cols="80" rows="25">
|
| 13 |
let x = 1;;
|
| 14 |
</textarea>
|
| 15 |
<br/>
|
| 16 |
</td>
|
| 17 |
<td width="50%" valign="top" onmousedown="show_result('a','');">
|
| 18 |
<input type="button" value="Clear" onclick="show_result('a','');"/>
|
| 19 |
<pre><div id="ares"></div></pre>
|
| 20 |
</td>
|
| 21 |
</tr>
|
| 22 |
</td>
|
| 23 |
<script type="javascript">
|
| 24 |
|
| 25 |
function clearreq(pr)
|
| 26 |
{ document.getElementById(pr+"req").value = ""; }
|
| 27 |
|
| 28 |
function show_result(pr,res)
|
| 29 |
{ document.getElementById(pr+"res").innerHTML = res; }
|
| 30 |
|
| 31 |
function submit(pr) {
|
| 32 |
var xmlhttp = new XMLHttpRequest();
|
| 33 |
xmlhttp.open("POST", "/cgi-bin/evaluator" ,true);
|
| 34 |
xmlhttp.onreadystatechange=function() {
|
| 35 |
if (xmlhttp.readyState==4) { show_result(pr,xmlhttp.responseText); }
|
| 36 |
}
|
| 37 |
show_result(pr,"Computing...");
|
| 38 |
xmlhttp.send(document.getElementById(pr+"req").value);
|
| 39 |
}
|
| 40 |
|
| 41 |
|
| 42 |
</script>
|
| 43 |
</body>
|
| 44 |
</html>
|