|
||||||
| Javascript Javascript Tutorials and Code |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
Introduction:-
Usually this is a difficult thing when it comes to programming and usually people get mixed up with arrays. Solution:- Make this Function between the <head> tags:- Code:
<SCRIPT language="JavaScript">
function array_use()
{
var msg= new Array(8)
msg[0]="Msg1";
msg[1]="Msg2";
msg[2]="Msg3";
msg[3]="Msg4";
msg[4]="Msg5";
msg[5]="Msg6";
msg[6]="Msg7";
msg[7]="Msg8";
var i=0;
for (i=0; i<8; i++)
{
alert(msg[i]);
}
}
</SCRIPT>
Code:
var msg= new Array(8) msg[0]="Msg1"; msg[1]="Msg2"; msg[2]="Msg3"; msg[3]="Msg4"; msg[4]="Msg5"; msg[5]="Msg6"; msg[6]="Msg7"; msg[7]="Msg8"; Code:
var msg = new Array("msg1","msg2","msg3","msg4","msg5","msg6","msg7","msg8");
Code:
<BODY onLoad="array_use()"> Code:
for (i=0; i<8; i++)
{
alert(msg[i]);
}
A Preview:- Conclusion:- As Always Feedback is welcome and the full source is attached!!
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() Business Directory | Technology Blog | Windows Help Last edited by TcM; 06-26-2008 at 01:30 PM. |
| Sponsored Links |
|
|
|
|||
|
Thanks to share this information,good information about how we can use array in <head> tag
|
|
|||||
|
Welcome.
Thanks for positive comment.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() Business Directory | Technology Blog | Windows Help |
|
|||||
|
Your code isn't particularly efficient. A shorter way to declare an array like that:
javascript Code:
|
| Sponsored Links |
|
|
|
|||||
|
These tutorials are not about efficiency, but about getting the basic thing and the concept of it into the readers mind.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() Business Directory | Technology Blog | Windows Help |
|
|||||
|
Yeah, but makes it harder for someone trying to learn the concept of Arrays.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() Business Directory | Technology Blog | Windows Help |
|
|||||
|
But as Arrays start with 0 and not with 1, if you don't make those indices, they might get confused. And they will not understand the concept of
Code:
alert(msg[i]);
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() Business Directory | Technology Blog | Windows Help |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Python arrays... | Sir_Rimo | Delphi/Python | 3 | 06-20-2007 08:54 AM |
| Arrays | clookid | PHP Tutorials | 1 | 01-11-2007 08:30 PM |
| Are arrays sort of like matrices? | Sionofdarkness | Java Help | 5 | 08-21-2006 02:30 PM |
| Arrays | Sionofdarkness | C and C++ | 5 | 07-26-2006 05:35 PM |
| Arrays in NET 2.0 or CLI Managed C++ | Void | Managed C++ | 1 | 07-18-2006 07:57 PM |