<input type="text" onkeydown="f(this)" onkeyup="f(this)" onblur="f(this)" onclick="f(this)" />

 


function f(o){
        o.value=o.value.toUpperCase().replace(/([^0-9A-Z])/g,"");
}