6/27/2018

JavaScript string

JavaScript 資料的型態
資料得形態物件得型態數值得型態
string-字串
number-數字
boolean-布林
object-物件
function-函數
Object-物件
Date-日期
Array-陣列
null-空值
undefined-無法定義


JavaScript string

JavaScript 資料的型態
資料得形態物件得型態數值得型態
string-字串
number-數字
boolean-布林
object-物件
function-函數
Object-物件
Date-日期
Array-陣列
null-空值
undefined-無法定義


6/23/2018

String constructor

String constructor length 指定的函式,建立字串。

語法 string.constructor,constructor 屬性包含用來建構該特定物件執行個體的函式參考。
語法 string.length,length 字串是不可變的因此無法修改字串的長度。
00

script JSON

class="hhh">JSON全名JavaScript Object Notation,為JavaScript物件實字(Object literal)的子集。

00
00

JSON.stringify(JSON) / Object.keys( ) / Object.values( )

JavaScript Array JSON
JSON.stringify(JSON) / Object.keys( ) / Object.values( )


00
00

00

00
#JavaScript Array #html Array #JavaScript Array JSON #html Array JSON #html Object.keys() #JavaScript Object.keys() #html Object.values() #JavaScript Object.values()

6/20/2018

setTimeout( )

setTimeout() 指定延遲時間執行一段程式

setTimeout() :指定一段程式碼或函式在多少毫秒(ms)後執行,並回傳此定時器的編號。
setTimeout( " JavaScript 程式碼 " , 時間間隔 ),時間間隔的時間單位是 1/1000 秒。
如果不只一行程式碼,則在兩行中間加上分號 (;) ,setTimeout("Code1 ; Code2", 時間間隔)。
setTimeout(function(){ .............}, 1000)。


clearTimeout() :清除定時器,可以通過將定時時產生的ID標識傳遞給 clearTimeout
    var id = setTimeout ( foo ,  1000 );
    clearTimeout ( id );

00

setTimeout( )

setTimeout() 指定延遲時間執行一段程式

setTimeout() :指定一段程式碼或函式在多少毫秒(ms)後執行,並回傳此定時器的編號。
setTimeout( " JavaScript 程式碼 " , 時間間隔 ),時間間隔的時間單位是 1/1000 秒。
如果不只一行程式碼,則在兩行中間加上分號 (;) ,setTimeout("Code1 ; Code2", 時間間隔)。
setTimeout(function(){ .............}, 1000)。


clearTimeout() :清除定時器,可以通過將定時時產生的ID標識傳遞給 clearTimeout
    var id = setTimeout ( foo ,  1000 );
    clearTimeout ( id );


00

6/17/2018

document.URL 讀取URL

document.URL 讀取URL | indexOf() | substring()

document.URL
document.URL.indexOf('ug5g')
document.URL.indexOf('com')
document.URL.indexOf('hk')
document.URL.substring(12,16)
document.URL.substring(17,20)
document.URL.length

document.URL 讀取URL

document.URL 讀取URL | indexOf() | substring()

JavaScript document.URL 得出網頁現在的網址,document.URL 取得現在的網址,包含了 domain 與網址的各項參數。
document.URL
document.URL.indexOf('ug5g')
document.URL.indexOf('com')
document.URL.indexOf('hk')
document.URL.substring(13,17)
document.URL.substring(18,21)
document.URL.length


location.href:
location.protocol:
location.hostname:
location.host:
location.port:
location.pathname:
location.search:
location.hash:
#html document.URL 讀取URL#script document.URL 讀取URL

343434 123 456 3434 343434