if ( twocode.replace(/^s+|s+$/g,"")=="" ) { alert("二维码不能为空"); document.getElementById("twocode").focus(); return false; }