I'm trying to conver the String "Hopper" to ASCII code and this is what I have so far. Unfornately, it only displays the ASCII code for the last character or 114. And I would like to the code to display all the codes for every character. What am I doing wrong?
Code:<script type="text/javascript"> function thisFunction() { var someString = "Hopper"; var j; for(j = 0; j < someString.length; j++) { document.thisForm.clearText.value = someString.charCodeAt(j); } } </script> <form name="thisForm"> <input type="button" value="Pass Value" onclick="thisFunction()"/> <br/> <textarea rows="6" cols="30" name="clearText"></textarea> </form>


Reply With Quote

Bookmarks