function checkalpha(e)
{
    var a=e.keyCode;

    if(!((a>=65 && a<=90) || (a>=97 && a<=122)))
    {
        e.keyCode=0;
    }

}

The above function work well in internet explorer for checking characters only in name

but same code not working in Mozila Firefox

please give me solution

I think IE is the only one that uses keyCode. I think you'll have to do something like this...

if(window.event){
	var a = e.keyCode
}else if(e.which){
	var a = e.which
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.