js动态适应input中字体大小
function autofs(obj) {
var fsOld = obj.getAttribute("fSize");
fsOld = Number(fsOld.replace("pt", ""));
var fs = obj.style.fontSize;
fs = Number(fs.replace("pt", ""));
var sw = obj.scrollWidth;
var ow = obj.offsetWidth;
if (sw > ow && fs > 1) {
fs--;
obj.style.fontSize = fs + "pt";
autofs(obj);
} else if (sw < ow && fs < fsOld) {
obj.style.fontSize = fsOld + "pt";
}
};