Hukum Storage setItem()
- Buguwar wuce getItem()
- Buguwar wuce removeItem()
- Turbu wuce Storage ɗanar
Amfani
sannan gudanin dona sannan dona rukun shi na kudu:
localStorage.setItem("mytime", Date.now());
Kauyawa da amfani
Hukum setItem() na rukun Storage yana sannan kiyasta kiyasta rukun rukun rukun:
Hukum setItem() na rukun Storage, wanda zai iya kuma: Rukun localStorage, wanda zai iya kuma: Rukun sessionStorage.
Gwagwarmaya masu yin amfani
Hukum | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
setItem() | 4 | 8 | 3.5 | 4 | 10.5 |
Yanayin:
localStorage.setItem(keyname, value)
ama:
sessionStorage.setItem(keyname, value)
Guddanin:
Akwai: | Tiratarwa |
---|---|
keyname | Dauki. Yadda ake kira: wanda yana nufin kiyasta: |
value | Dauki. Yadda ake kira: wanda yana nufin kiyasta kiyasta: |
Rarrabawar ilimi
Wurin DOM: | Web Storage API |
---|---|
Guddanin: | Guddanin mai yin kiyasta, wanda yana nufin kiyasta: |
Amfani da yau:
Amfani
Amfani da yana fi da cikin rukun shi na shirin kuma ba ta iya yi da rukun shi na kudu ba:
sannan gudanin dona sannan dona rukun kuma dake shi:
sessionStorage.setItem("test1", "Lorem ipsum");
Amfani
kau tunan koyi gudanin kama (obj.key) dona sannan:
sessionStorage.test1 = "Lorem ipsum";
Amfani
kau tunan koyi sannan:
sessionStorage["test1"] = "Lorem ipsum";
- Buguwar wuce getItem()
- Buguwar wuce removeItem()
- Turbu wuce Storage ɗanar