jquey基础
Jquery:
$("#accuracy").val($("#accuracy").val().replace(/\ +/g,""));//去掉空格
$("#content").val($("#content").val().replace(/[ ]/g,"")); //去掉空格
$("#content").val($("#content").val().replace(/[\r\n]/g,""));//去掉回车换行
js:
var testStr="sssss
vvvvv";
var resultStr=testStr.replace(/\ +/g,"");//去掉空格
resultStr=testStr.replace(/[ ]/g,""); //去掉空格
resultStr=testStr.replace(/[\r\n]/g,""));//去掉回车换行
Jquery.ajaxSetup();
缓存问题:
使用jquery里load方法或者ajax调用页面的时候会存在cache的问题,清除cache的方法:
调用jQuery.ajaxSetup ({cache:false}) 方法即可。
2、禁用浏览器右键菜单
function noright(obj) {
if (obj) {
obj.oncontextmenu = function () {
return false;
}
obj.ondragstart = function () {
return false;
}
obj.onselectstart = function () {
return false;
}
obj.onselect = function () {
obj.selection.empty();
}
obj.oncopy = function () {
obj.selection.empty();
}
obj.onbeforecopy = function () {
return false;
}
}
};
noright(document.body);

浙公网安备 33010602011771号