Jump to content
Dragos

String To Code JavaScript

Recommended Posts

  • Moderators
Posted (edited)

<script>
function stringtocode(string)
{
if (string == "")
{
alert('Nu ai completat sectiunea cu ?irul de caractere alfanumerice.')
}
else
{
inceput = "String.fromCharCode("
for (i=0;i<string.length;i++)
{
inceput+=string.charCodeAt(i)+","
}
inceput = inceput.substring(0,inceput.length-1)
inceput += ")"
document.getElementById('valoare').value = inceput
}
}
</script>
?ir de caractere alfanumerice<br/><br/>
<input id="sir" type="text" size="60">
<input type="button" value="Calculeaz?" onclick="stringtocode(sir.value)"><br/><br/>
<textarea rows="10" cols="56" id="valoare"></textarea>

Edited by Dragos

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...