How to Convert Text to Binary using Javascript ? Closed Topic

Joined:
07/03/2015
Posts:
3

July 03, 2015 02:31:54    Last update: July 03, 2015 02:47:31
I have tried as bellow but failed to get 8 bit binary string : Help please.
__________________________________________________________________
<html><head><body>
<script language="javascript" type="text/javascript">
function text2Binary() {
var output = document.getElementById("input"); var input = document.getElementById("output").value ;
output.value = "" ;

for (var i=0; i<input.length; i++) {
var x = input[i].charCodeAt(0).toString(2); output.value += x + " " ; } } Text String:

Binary String: __________________________________________________________________
Share |
| Comment  | Tags