Create a simple text to ascii converter - Javascript String Operation

Javascript examples for String Operation:String Convert

Description

Create a simple text to ascii converter

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script type="text/javascript">
function asciify(txt) {/* ww  w  . j a v a  2 s. co m*/
    return txt.charCodeAt(0);
}

      </script> 
      <form> 
         <textarea name="txt_input"></textarea> 
         <input type="button" value="Submit" onclick="this.form.txt_output.value = asciify(this.form.txt_input.value)"> 
         <textarea name="txt_output"></textarea> 
      </form>  
   </body>
</html>

Related Tutorials