I have a HTML form:
<html>
<body>
<form>
<textarea></textarea>
<input type="button" value="Submit" onclick="????"></input>
</form>
<script type="text/javascript">
var code, chr = 'here';
code = chr.charCodeAt(0);
document.write("The ASCII code of " + chr +" is "+code);
</script>
</body>
</html>
I’m trying to have a text area in which user/me will put his text (a single letter) and a button which he will click to trigger this event.
Now the problem is how do I make the submit button to submit the whatever is in the text area to:
var code, chr = '`here`';
Please let me know if there is additional data required.
If I understand what you’re looking forL you need a function that ascii translates input and you need to call that from the button.
I would suggest using something like the following because the calls from the button are all relative you could have 15 such forms on a page and they will all work, plus your actual translation method is kept simple and discrete.
Although with something so simple you could just Drop it inline.