javascript

I have to insert in the view page a function javascript to control if the data that i insert is an integer because in my db data as number,fax telephone not are integer but varchar2(oracle db)

this is my function


function checkNumbers(e) {

	var key;

	var keychar;

	var myregexp = /^[0-9]+$/;

	

	if (window.event) key = window.event.keyCode;

	else if (e) key = e.which;

	else return true;

	

	keychar = String.fromCharCode(key);

	

	// control keys

	if ((key==null) || (key==0) || (key==<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' /> || (key==9) || (key==13) || (key==27) ) return true;

	

	else if ( myregexp.test(keychar) ) return true;

	

	else return false;

    

}



and the event is

onkeypress="return checkNumbers(event)

Can you help me????

Don’t do with javascript, simpy change the rule of the model.