//使用正则替换所有中文字符,然后再计算
function getBLen(str) {
if (str == null) return 0;
if (typeof str != "string"){
str += "";
}
return str.replace(/[^\x00-\xff]/g,"ab").length;
}
document.getElementById("tijiao-button").removeAttribute("disabled");
钮变灰不可用方法:
document.getElementById("crop").setAttribute("disabled", true);
字符串中含有html标签的处理
最新推荐文章于 2024-07-07 23:10:31 发布