Javascript Code :-
function onlyDemialValues(objEvent, id) {
var iKeyCode;
if (window.event) // IE
{
iKeyCode = objEvent.keyCode;
}
else if (objEvent.which) // Netscape/Firefox/Opera
{
iKeyCode = objEvent.which;
}
if (iKeyCode >= 48 && iKeyCode <= 57 || iKeyCode == 46 || iKeyCode == 8) {
if (iKeyCode == 46) {
if (document.getElementById(id).value.indexOf(".") != -1) return false;
}
return true;
}
return false;
}
Nice code .........
ReplyDeleteNice Explanation.
ReplyDeleteJavaScript Training
JavaScript Training in Chennai
Online JavaScript Training
Thanks for sharing. It is very helpful.
ReplyDeleteRajasthan Technical University