Previous Example-|-Next Example-|-Return to Chapter Listing

Example 7.14:
Built-in Functions--escape


This page uses a built-in function, escape(form.txtCharacter.value), to return the ASCII encoding value of a character in the ISO Latin-1 character set. Type one or more non-alphanumeric characters into the text box, then click on the button to see the ASCII encoding value or values:
Type any character:



These are the scripts we used. First, in the HEAD: <SCRIPT LANGUAGE="JavaScript"> <!-- function ConvertASCII(form) { form.txtASCII.value= escape(form.txtCharacter.value) } //--> </SCRIPT> Later in the Web page the function is called from this form: <FORM> Type any character: <INPUT TYPE="text" NAME="txtCharacter" SIZE=12><P> <INPUT TYPE="button" VALUE="ASCII Value" onclick="ConvertASCII(this.form)"> <INPUT TYPE="text" NAME="txtASCII" SIZE=20> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing