|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i want to search an array and return one set of data if the keyword is in the array and a different set of data if it is not. i have an idea of how to do this, but it doesn't seem to be working... any suggestions or help would be greatly appreciated.
|
|
#2
|
|||
|
|||
|
Hi:
You can see this code: <script language="JavaScript"> var arreglo = new Array(10); function search(arreglo,element) { var i = 0 ; var flag = true ; while (i<10 && flag) { if (arreglo[i]==element) flag = false; else i++; } if (flag)//element dont searched return false; else return true; } |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > searching through an array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|