JS初學筆記(3)

2021-07-25 15:53:57 字數 823 閱讀 9530

js物件屬性(一切事物皆物件):

字串物件:length(返回長度);indexof(a)(返回第乙個字串出現的位置,沒有就是-1);replace(a,b)(替換)返回的修改後的字串,不會修改原字串;search(a),返回的也是位置.

var str="hello world!";

document.write(str.length+"

");document.write(str.indexof("hello")+"

");document.write(str.replace("world","js")+"

");document.write(str.match("hello")+"

");document.write(str.search("hello")+"

");document.write(str); 12

0hello js!

hello

0hello world!

建立js物件:

var person=new object();

person.firstname="bill";

person.lastname="gates";

person.age=56;

訪問物件的屬性就是 objectname.propertyname

js函式語法:

function functionname()

和後台一樣,引數之間用逗號隔開;也可以和後台一樣設定return語句

js同樣存在區域性變數和全域性變數,變數的生存期也和後台一樣,js的生命期從被宣告開始,區域性變數在函式結束被刪除,全域性變數則是頁面關閉時被刪除。

初學oracle筆記 3

使用子查詢的方式建立表 create table 表名 as 查詢語句 注意 只會複製表結構和表中的資料,不會有列的約束 新增列alter table 表名 add 列名 varchar 10 修改列名 alter table 表名 rename column 舊列名 to 新列名 修改列 modi...

初學HTML筆記(3 標籤

屬性值描述 alttext 當圖形顯示錯誤時,定義圖形的簡短描述 srcurl 要顯示的圖形的url align top,bottom,middle,left,right 規定如何根據周圍的文本來對齊影象,html5不支援,使用css代替 border pixels 畫素數值 定義影象周圍的邊框,h...

XML初學高階學習筆記 3

25 dom的全稱是document object model,也即文件物件模型。在應用程式中,基於dom的 xml分析器將乙個 xml文件轉換成乙個物件模型的集合 通常稱dom樹 應用程式正是通過對這個物件模型的操作,來實現對 xml文件資料的操作。通過dom介面,應用程式可以在任何時候訪問 xm...