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:-
Instead ofCode:<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>
You can make (Untested)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";
And call it with something like this:-Code:var msg = new Array("msg1","msg2","msg3","msg4","msg5","msg6","msg7","msg8");
Explanation:-Code:<BODY onLoad="array_use()">
This is a Loop that will display a msg and increase i by one every time and it will go on until i<8Code:for (i=0; i<8; i++) { alert(msg[i]); }
A Preview:-
Conclusion:-
As Always Feedback is welcome and the full source is attached!!


LinkBack URL
About LinkBacks





Reply With Quote




Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum