是关闭而非刷新 是刷新而非关闭


<BODY>
<script language=javascript>
window.onbeforeunload = function(){
var n = window.event.screenX - window.screenLeft;
var b = n > document.documentElement.scrollWidth-20;
if(b && window.event.clientY < 0 || window.event.altKey)
{
alert("是关闭而非刷新");
window.event.returnValue = "是否关闭?";
}else{
alert("是刷新而非关闭");
}
}

function commafy(num){
num = num+"";
var re=/(-?/d+)(/d{3})/
while(re.test(num)){
num=num.replace(re,"$1,$2")
}
return num;
}
</script>
<input type=button value="commafy" onclick="alert(commafy(1234532但是说到底是多少多少67000.01))">
<input type= "text">
<input type= "text " style= "text-align: right; " onfocus= "this.value =this.value.replace(/,/gi,'')" onblur= "this.value=commafy(this.value);"/>

</BODY>

你可能感兴趣的:(刷新)