[JavaScript] 限制用户只能输入数字 →→→→→进入此内容的聊天室

来自 , 2020-04-30, 写在 JavaScript, 查看 111 次.
URL http://www.code666.cn/view/054ab897
  1. $.fn.fontfit = function(max) {
  2.         var max_size = 18;
  3.         if (typeof(max) == "undefined")
  4.                 max = max_size;
  5.         $(this).wrapInner('<div id="fontfit"></div>');
  6.         var dheight = $(this).height();
  7.         var cheight = $("#fontfit").height();
  8.         var fsize = (($(this).css("font-size")).slice(0,-2))*1;
  9.         while(cheight<dheight && fsize<max) {
  10.                 fsize+=1;
  11.                 $(this).css("font-size",fsize+"px");
  12.                 cheight = $("#fontfit").height();
  13.         }
  14.         while(cheight>dheight || fsize>max) {
  15.                 fsize-=1;
  16.                 $(this).css("font-size",fsize+"px");
  17.                 cheight = $("#fontfit").height();
  18.         }
  19.         $("#fontfit").replaceWith($("#fontfit").html());
  20.         return this;
  21. }
  22. //javascript/1076

回复 "限制用户只能输入数字"

这儿你可以回复上面这条便签

captcha