A few years ago I developed a basic graphical interpreter similar to LOGO, I could not post it on the Internet (as my cousin continues to listen to me). Although I am completely new to HTML, Javascript coding, I thought I would try and take this as a learning experience.
The code below is for the base interface only (my interface looks very ugly and I will clear it later).
I wrote a pushCmd Javascript function called onsubmit "cmd-form".
function pushCmd()
{ var cmdText = document.forms["cmd-form"]["cmd-text"].value;
var srcElement = document.getElementById("source-container");
var srcText = new String(srcElement.innerHTML);
srcText = srcText.toUpperCase();
if (srcText.indexOf("NO CODE") != 0)
{
srcText = cmdText;
}
else
{
srcText += "<br>" + cmdText;
}
srcElement.innerHTML = srcText;
}
The form is announced as shown below.
<div id="command-container">
<form name="cmd-form" action="" onsubmit="pushCmd()" onreset="resetSource()" method="post">
<input type="text" name="cmd-text" size="80">
<input type="submit" value="Send">
<input type="reset" value="Reset">
<input type="button" value="Run">
</form>
</div>
The pushCmd function should modify the HTML content of div-source-container, which looks lower by default.
<div id="source-container">NO CODE</div>
, (, "FWD 100" ). "source-container" "FWD 100". , "RT 90", "FWD 100
RT 90". , .
. "source-container" , "NO CODE". , - , ?
get post, . Javascript. Google chrome Version 26.0.1410.63, ( , ).
, , HTML .