Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies




3:37 pm on Feb 6, 2002 (gmt 0)

10+ Year Member

I know I've been posting alot lately about javascript but I'm in the process of learning it. It's getting much esier than it was at the begining of last week. Thank you all for helping me get this far.

Now, heres my question

I'm doing a statement similar to this.
function loadData(placement) {
for (i = placement; i < placement + 10; i++) { // start of for
if (i > placement) {
document.write('<tr><td bgcolor="#666666" align="right"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">' + gather_info_date[i] + '</font></b></td></tr>');
document.write('<tr><td align="left" bgcolor="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">' + gather_info_content[i] + '</font></td></tr>');
// END
} // end of for

// What is the equivalent of ENDing a script in Javascript?

I'm trying to tell it that if i is greater then placement, stop printing the document.write. I dont know if I'm doing it right or not but most of the code is coming along just great! :)



6:15 pm on Feb 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

to jump out of a loop (such as a for loop) use:



6:24 pm on Feb 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Also worth mentioning here that if you're in a function and you want to leave the function at certain point - i.e. not process the remaining instructions you can return false;.

Featured Threads

Hot Threads This Week

Hot Threads This Month