View Full Version : javascript table generator

11-09-2006, 10:31 PM
Hi there if someone could help i would really apreciate it.I am looking for a table generator that works with prompts. Something like this the first prompt asks How many rows? second prompt How many columns? third prompt Border size fourth prompt Bgcolor and fifth prompt Create table... If someone could help me out with source code i will be very grateful....

11-09-2006, 11:45 PM
Well, I sure dislike all those bells when I work with prompts and alerts.
What do you think of this?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HEAD><TITLE>MakeAtable </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<STYLE type=text/CSS>
<SCRIPT type="text/javascript">
function mktbl(r,c){

var stbl='<TABLE BORDER="1">\n <TBODY>\n';
for(j=0;j<r;j++){stbl+=' <TR>\n'; for(i=0;i<c;i++){stbl+=' <TD> @ </TD>\n';}; stbl+=' </TR>\n'}
stbl+=' </TBODY>\n</TABLE>\n';
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<TABLE cellpadding=0 cellspacing=0 border=1>
<TD><input type="button" class="bttn" onclick="mktbl(1,1)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(1,2)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(1,3)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(2,1)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(2,2)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(2,3)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(3,1)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(3,2)"></TD>
<TD><input type="button" class="bttn" onclick="mktbl(3,3)"></TD>
<TD><textarea id="abc" style="height:300;width:300"></textarea>
<TD id="def"></TD>


Something gets lost when I paste that inot notepad,
here, have it direct and change the extension to .html