var arr = new Array();
arr[1] = new Array("page1_start P","page1_stop");
arr[3] = new Array("page3_start","page3_stop");
for(i=1; i<arr.length; i++){
alert("start is: "+arr[i][0]);
alert("stop is: "+arr[i][1]);
}
</script>
arr[1] = new Array("page1_start","page1_stop");
arr[3] = new Array("page3_start","page3_stop");
arr[4] = new Array("page4_start","page4_stop");
arr[6] = new Array("page6_start","page6_stop");
for(i=1; i<arr.length; i++)
{
if(arr[i]==arr[2]||arr[i]==arr[5] ) continue;
alert("start is: "+arr[i][0]);
alert("stop is: "+arr[i][1]);
}
แบบนี้ก็ใช้ได้ ใช้ในกรณีที่รู้ indexที่หายไป
ถ้าไม่รู้ละ คิดไม่ออก???!@#$%^&*(*&^
Date :
2011-08-03 16:24:42
By :
ckcr
No. 2
Guest
Code (PHP)
var arr = new Array();
arr[1] = new Array("page1_start P","page1_stop");
arr[3] = new Array("page3_start","page3_stop");
for(i=1; i<arr.length; i++){
if (typeof arr[i] != 'undefined'){
alert("start is: "+arr[i][0]);
alert("stop is: "+arr[i][1]);
}
}