javascript code prompts
Posted: Mon Apr 19, 2004 1:48 pm
i decided to try to add code prompts to the forums to make it easier for ppl to add my version of bb code. the problem is that three cases in the switch aren't working
to see what i have in action, go here: http://24.91.157.113/findyourdesire/ztest.html
the three that aren't working are table, ordered list and unordered list.
issues:
table: not giving cell prompts or making rows/columns
ordered list: not doing anything after getting prompt info
unordered list: same as ordered
i thought the issue might have something to do with using a number a as a string and so i used *1 to cast it as a number, but that changes nothing.
to see what i have in action, go here: http://24.91.157.113/findyourdesire/ztest.html
the three that aren't working are table, ordered list and unordered list.
issues:
table: not giving cell prompts or making rows/columns
ordered list: not doing anything after getting prompt info
unordered list: same as ordered
Code: Select all
case 'ol': // ordered list
add1=prompt('How many items in the list?')*1;
if(add1>0){ // we're going to have items
build=build+'їol]';
for(i=0;i<add1;i++){ // for each item to add
add2=prompt('Enter item',''); // get the item
build=build+'їitem]'+add2+'ї/item]'; // add it
}
build=build+'ї/ol]'; // finish the list
}
break;
case 'table': // adds a table
add1=prompt('How many rows would you like?',''); // get # of rows
if(add1>0){ // there's some rows
add2=prompt('How many columns would you like?',''); // get # of cols
if(add2>0){ // we'll make a table
build='їtable]';
for(i=0;i>add1;i++){ // for each row..
build=build+'їrow]';
for(j=0;j<add2;j++){ // for each cell, get the data and add it
prmpt='Enter cell data for row '+add1+' column '+add2
add3=prompt(prmpt,''); // get the item
build=build+'їcell]'+add3+'ї/cell]';
}
build=build+'ї/row]'; // make the row
}
build=build+'ї/table]'; // finish the table
}
}
break;
case 'ul': // unordered list
add1=prompt('How many items in the list?');
if(add1>0){ // we're going to have items
build=build+'їul]';
for(i=0;i<add1;i++){ // for each item to add
add2=prompt('Enter item',''); // get the item
build=build+'їitem]'+add2+'ї/item]'; // add it
}
build=build+'ї/ul]'; // finish the list
}
break;