寫法就是........那樣那樣
可是之前我寫的陣列是
var url = new Array();
url[0] = 'http://i279.photobucket.com/albums/kk147/bittyferrari/Blog/ValentinesDayWallpaper_resize-1.jpg';
url[1] = 'http://i279.photobucket.com/albums/kk147/bittyferrari/header6.jpg';
url[2] = 'http://i279.photobucket.com/albums/kk147/bittyferrari/header5.jpg';
url[0] = 'http://i279.photobucket.com/albums/kk147/bittyferrari/Blog/ValentinesDayWallpaper_resize-1.jpg';
url[1] = 'http://i279.photobucket.com/albums/kk147/bittyferrari/header6.jpg';
url[2] = 'http://i279.photobucket.com/albums/kk147/bittyferrari/header5.jpg';
[]裡面放0~1~2
可是我有新車的時候就會想增加上去
這時可能就[3] [4]
這寫法真的比較鳥.........尤其遇到中間有些圖想拿掉的
那數字又要改~~~~超麻煩XD
現在我改這種寫法~~~~要改要換比較隨心所欲
var url = new Array();
url.push('http://i574.photobucket.com/albums/ss184/bittylamborghini/badass_header.jpg');
url.push('http://i574.photobucket.com/albums/ss184/bittylamborghini/pk2_header.jpg');
url.push('http://i574.photobucket.com/albums/ss184/bittylamborghini/pk2_header2.jpg');
url.push('http://i574.photobucket.com/albums/ss184/bittylamborghini/badass_header.jpg');
url.push('http://i574.photobucket.com/albums/ss184/bittylamborghini/pk2_header.jpg');
url.push('http://i574.photobucket.com/albums/ss184/bittylamborghini/pk2_header2.jpg');
用push的方法~~~~~cool~~~~
reference
http://www.w3schools.com/jsref/jsref_push.asp
沒有留言:
發佈留言