
javascript
niu_hao
这个作者很懒,什么都没留下…
展开
-
js报错:size is not a function
jquery报错 .size is not a function原创 2022-10-25 17:24:22 · 1890 阅读 · 1 评论 -
js中parseFloat(第一个参数,第二个参数)中第二个参数是什么意思
今天在看jquery的时候里面用到了parseFloat(第一个参数,10),一直不懂第二个参数是什么意思,于是上网查了一下,怕以后忘记就记下来。定义和用法:parseFloat() 函数可解析一个字符串,并返回一个浮点数。语法:parseFloat(string),参数string是必须的,表示要被解析的字符串返回值:返回解析后的数字注意事项:原创 2013-01-26 20:48:03 · 8170 阅读 · 0 评论 -
javascript setHours()方法
定义与用法setHours()方法可用来指定时间的小时,分钟,秒数语法dateObject.setHours(hour,min,sec,millisec)参数描述hourRequired. A numeric value between 0 and 23 representing the hour必选。转载 2013-03-19 16:30:21 · 2159 阅读 · 0 评论 -
JS保留两位小数 四舍五入函数
js 四舍五入函数 toFixed(),里面的参数 就是保留小数的位数。 document.write("JS保留两位小数例子"); var a=2.1512131231231321; document.write("原来的值:"+a+""); document.write("两位小数点:"+a.toFixed(2)+"四位小数点"+a.toFixed(4));转载 2013-04-16 11:34:54 · 5875 阅读 · 0 评论 -
js去除空格
SCRIPT LANGUAGE="JavaScript">//出处:网上搜集 // Trim() , Ltrim() , RTrim()String.prototype.Trim= function(){ return this.replace(/(^\s*)|(\s*$)/g,"");} String.prototype.LTr转载 2013-05-21 17:15:49 · 764 阅读 · 0 评论 -
如何使定义了高度和宽度的<a>里的文字垂直居中
html xmlns="http://www.w3.org/1999/xhtml">head>meta http-equiv="Content-Type" content="text/html; charset=gb2312" />title>垂直居中title>style type="text/css">.txt {width:150px;转载 2013-05-21 15:37:36 · 9102 阅读 · 2 评论 -
JS的substr和substring
substr 方法 返回一个从指定位置开始的指定长度的子字符串。 stringvar.substr(start [, length ]) 参数 stringvar 必选项。要提取子字符串的字符串文字或 String 对象。 start 必选项。所需的子字符串的起始位置。字符串中的第一个字符的索引为 0。 length 可选项。转载 2014-08-07 01:38:10 · 699 阅读 · 0 评论