js中string math,date對象

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">html

<html xmlns="http://www.w3.org/1999/xhtml">dom

<head>ui

<title>String對象</title>spa

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />xml

<meta name="description" content="布爾教育 http://www.itbool.com" />htm

<script>對象

var str="helloworld";ip

var  str1="hello";utf-8

document.write(str.concat(str1));字符串

document.write(str.indexOf(str1)); //若是沒有,返回-1

var dt=new Date();

document.write(dt.getFullYear());

document.write(Math.floor(2.3));

alert(Math.random()*5+5);//5-10的隨機數

</script>


</head>

    <body>

     String 對象的方法length

     str.concat鏈接兩個字符串

     str.indexOf查找字符串出現的位置

     str.sbustr截取字符串

str.toLowerCase 都轉化爲小寫 toUpperCase 轉大寫

     Date對象

     getFullYear 獲取年

Math對象

Array對象等

    </body>

</html>

相關文章
相關標籤/搜索