|
Forms >>>
When submitting the form "GET" method, JavaScript can encode special characters with the escape() function. Great! (Enter a nickname or password with some special variables then click 'submit' to see the web address which contains the encoded (%xx) characters.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
processForm(form)
{
var
nickname =
form.nickname.value;
var
password =
form.password.value;
nickname
=
escape(nickname);
password
=
escape(password);
window.location
=
window.location
+
"?nickname="
+
nickname +
"&password="
+
password;
}
</script>
<form
action="">
<tt><pre>
Nickname:
<input
type=text
name=nickname
value=""
size=10>
Password:
<input
type=text
name=password
value=""
size=10>
<input
type=button
value="Submit!"
onClick="javascript:processForm(this.form);">
</pre></tt>
</form>
|
|