Pranay Rana: September 2009

Thursday, September 17, 2009

Java Script for validation decimal number on key press event

function CheckUnit(obj,event)
{

if ( event.keyCode == 8 event.keyCode ==46
event.keyCode == 37 event.keyCode ==39 )
{
event.returnValue = true;
return true;
}

if (((event.keyCode <> 57)) )
{
if (event.keyCode !=190)
{
event.returnValue = false;
return false;
}
}
if( (String.fromCharCode(event.keyCode)) =="¾")
{
var val = obj.value;

if(val.indexOf(".") > -1)
{
event.returnValue = false;
return false;
}
}

}



























Java Script To Fill UP combo box form other one

for(var i=0;i<(document.getElementById(idBilling)).length;i++) { (document.getElementById(idBilling)).remove(i); } for(i=0;i {

var newOption = new Option();
newOption.text = objPersonal[i].text;
newOption.value =objPersonal[i].value;
var billing = document.getElementById(idBilling);
(document.getElementById(idBilling)).options[i] = newOption;
}