JavaScript
정규식
기계식키보드
2010. 7. 26. 19:17
숫자만 입력 가능
$("#phone").bind('keyup', function(e){
$(this).val( $(this).val().replace(/[^0-9]/g, ""));
});
스크립트 제거
function removeScript(str) {
var re = /\r\n/g;
str = str.replace(re, "@!-_-!@");
re = /<\s*script.+?<\/\s*script\s*>/gi;
str = str.replace(re, "");
re = /@!-_-!@/g;
str = str.replace(re, "\r\n");
re = /^\r\n/g;
return str.replace(re, "");
}