sadece tamsayı
sadece harf ve sayı gibi formlar oluşturabilirsiniz
head
HTML-Kodu:
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Corneliu Lucian 'Kor' Rusu | corneliulucian[at]gmail[dot]com */
var r={
'special':/[\W]/g,
'quotes':/['\''&'\"']/g,
'notnumbers':/[^\d]/g
}
function valid(o,w){
o.value = o.value.replace(r[w],'');
} body
HTML-Kodu:
<form id="myform" method="" onsubmit="return false;">
This field will not accept special characters: (like !@#$%* etc,) - but accepts underscore _
<br> <input type="text" size="35" name="comments" onkeyup="valid(this,'special')" onblur="valid(this,'special')"></textarea> <br> <br>
This field will not accept double or single quotes:
<br> <input type="text" size="35" name="txtEmail" onkeyup="valid(this,'quotes')" onblur="valid(this,'quotes')"> <br> <br>
This field will only accept integer numbers:
<br> <input type="text" size="35" name="txtPostal" onkeyup="valid(this,'notnumbers')" onblur="valid(this,'notnumbers')"> </form>