知識點總結

2022-05-04 09:27:09 字數 2583 閱讀 1712

1.ie瀏覽器中,如果json陣列中最後乙個元素含有,(逗號),ie瀏覽器會報錯。====js中寫json陣列時養成習慣,最後乙個元素的,要去掉。

2.在js或php中判斷乙個變數是否為0或1,要用if(id === '1'),而不能用if(id == 1).因為用後面的方法判斷0或1時有時系統會判斷是true或false,而不是數字0或1.

3.oracle使用order by 排序時,如果排序欄位中的值為null,oracle預設null是最大的,按asc排序時,null值會排在最後,desc排序時,null會排在最前。可以在order by 語句後面加上 nullsfirst(null值排最前)或null last(null排最後)處理。

4.js擷取字串

var aa = '123456';

aa.substr(0,length);

5.php擷取字串

$aa = '123456';

substr($aa, 1, 2); //

輸出 23

6.php拆分字串

$str = '1^2^3';

explode("^",$str);//

按照^拆分

7.把乙個字串寫入檔案中

file_put_contents() ;//

函式把乙個字串寫入檔案中。

示例:file_put_contents('./test.txt',$data);//

將$data字串放入test.txt檔案中,在當前php檔案目錄下生成text.txt檔案。

8.html字間距

(1)text-indent設定抬頭距離css縮排

即對,對應div設定css樣式text-indent : 20px; 縮排了20px

(2)letter-spacing來設定字與字間距_字元間距離,字型間距css樣式

即對對應div設定css屬性樣式為letter-spacing:8px;,字間距為8px

9. js中的each的用法

var arr = [ "one", "two", "three", "four"];     

$.each(arr,

function

());

//上面這個each輸出的結果分別為:one,two,three,four

var arr1 = [[1, 4, 3], [4, 6, 6], [7, 20, 9]]

$.each(arr1,

function

(i, item));

//其實arr1為乙個二維陣列,item相當於取每乙個一維陣列,

//item[0]相對於取每乙個一維陣列裡的第乙個值

//所以上面這個each輸出分別為:1 4 7

var obj = ;

$.each(obj,

function

(i) );

//這個each能迴圈每乙個屬性

//輸出結果為:1 2 3 4

10.子頁面取父級頁面的id

window.parent.window.document.getelementbyid("id").innerhtml() = '';
11.顯示錯誤時載入預設的。

12.**隱藏或顯示

**隱藏或顯示時要使用.hide()或.show();不能使用css中的display,block或者none,樣式會發生錯亂。

13.sql替換語句

lieming字段資訊中的2011替換成2014

updatetabsetlieming =replace(lieming,'2011','2014');

14.border顏色漸變

border-bottom: 5px solid;

border-image: -webkit-linear-gradient( 330deg, #4f70a9 , #bcad80) 40% 1%;

border-image: linear-gradient( 330deg, #4f70a9 , #bcad80) 40% 1%;

border-image: linear-gradient( 330deg, #4f70a9 , #bcad80) 40% 1%;

border-image: -webkit-linear-gradient( 330deg, #4f70a9 , #bcad80) 40% 1%;

知識點總結

1,迴圈中的中斷 continue 跳出此次迴圈,繼續for迴圈 break 跳出當前for迴圈 return 跳出當前方法 2,字串的操作 componentseparatedbystring stringbyreplacingoccurencesofstring withstring iskin...

知識點總結

oncreate onstrat onresume onpause onstop onrestart ondestroy standard 啟動activity都會產生乙個新的activity 預設模式 singletop 啟動activity允許多個,但不允許重疊 singletask 只允許有乙...

知識點總結

function go go 呼叫 go為變數名 setinterval go,1000 1000ms clearinterval 關閉定時器 function abc a,b 2,3 5undefined 未定義 null 空 nan 非數值 string 字串 var a 123 數字型別 va...