val num or char




JavaScript Source Code 3000: Forms: Validation (Num. or Chars)






































Validation (Num. or Chars)







Validates an input field to make sure that only a number or character is entered. If you enter a number or a letter everything you can continue on. But, try entering another value like an exclamation point (!), an ampersand (&), or a dollar sign ($) and see what happens. It even highlights the incorrect entry field for you. Nice!















JavaScript Source Code 3000: Forms: Validation (Num. or Chars)
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!





    





<!-- TWO STEPS TO INSTALL VALIDATION (NUM. OR CHARS):

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<! >
<! >

<!-- Begin
function validate(field) {
var valid = "abcdefghijklmnopqrstuvwxyz0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only characters and numbers are accepted!");
field.focus();
field.select();
}
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<center>
<form onSubmit="http://your-web-site-address-here.com/script.cgi">
<input type=text name="entry" onBlur="validate(this)">
<br>
<input type=submit value="Submit Form">
</form>
</center>



<!-- Script Size: 1.13 KB -->










Wyszukiwarka

Podobne podstrony:
val char
całkowanie num metoda trapezów
3E D&D Adventure 06 or 08 Equinox
Cipriani Invisible Relligion or Diffused Religion in Italy
char spd40
char wfs130n
push or fold heads up
Or Operator koparko spycharki
wybrane char pierw
char nua25hcb
Coming Closer or Drifting Apart
Or Kasjer na stacji paliw
function msql num rows

więcej podobnych podstron