当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JavaScript[对象.属性]集锦之三

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 JavaScript[对象.属性]集锦之三


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-10   浏览: 366 ::
收藏到网摘: n/a

string对象


string对象为操作字符串的内容提供了很多方法.


属性

length 字符串的长度,即字符串中字符的个数.


方法

big(),blink(),bold(),fixed(),italics(),small(),sub(),strike(),sup(),fontColor(color),fontSize(size)

以上方法为字符串增加相应的HTML标记.

charAt(index) 返回字符串中index处的字符.

indexOf(searchValue,[fromIndex]) 该方法在字符串中寻找第一次出现的searchValue.如果给定了fromIndex,则从

字符串内该位置开始搜索,当searchValue找到后,返回该串第一个字符的位置.

lastIndexOf(searchValue,[fromIndex]) 从字符串的尾部向前搜索searchValue,并报告找到的第一个实例.

substring(indexA,indexB) 获取自indexA到indexB的子串.

toLowerCase(),toUpperCase() 将字符串中所有字符全部转换成大写,小写.



Date对象


要使用Date对象,必须先生成一个Date实例:

变量名=new Date();

方法

getDay(),getDate(),getHours(),getMinutes(),getMonth(),getSeconds(),getTime(),

getTimeZoneOffset(),getYear()

还有setDay... ...

toGMTString() 用GMT格式返回当前时间. (Sun,12 Feb 1999 14:19:22 GMT)

toLocaleString 用locale格式返回当前时间. (03/11/99 14:19:22)

parse(date) 将普通date字符串转换成豪秒形式,从而给setTime()做参数.


Math对象


属性

LN10 (10的自然对数)

PI (3.1415926...)

SQRT1_2 (1/2的平方根)

方法

abs(x) 返回x的绝对值

acos(x) 返回x的arc cosine值

asin(x) 返回x的arc sin值

atan(x) 返回x的arc tangent值

ceil(x) 返回大于等于x的最小整数

cos(x) 返回x的cosine值

exp(x) 返回e的x次方

floor(x) 返回小于等于x的最大整数

log(x) 返回x的

max(x,y) 返回x,y中的大值

min(x,y) 返回x,y中的小值

pow(x,y) 返回x的y次方

round(x) 舍入到最近整数,(小于或等于0.5小数舍去)

sin(x) 返回x的sin值

sqrt(x) 返回x的平方根

tan(x) 返回x的tangent值