Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript table generator

    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....

  • #2
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    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">
    <HTML>
    <HEAD><TITLE>MakeAtable </TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <STYLE type=text/CSS>
    *{height:15;width:15}
    </STYLE>
    <SCRIPT type="text/javascript">
    function mktbl(r,c){
    document.getElementById('abc').value='';

    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';
    document.getElementById('def').innerHTML=document.getElementById('abc').value=stbl;
    }
    </SCRIPT>
    <META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
    <BODY>
    <TABLE cellpadding=0 cellspacing=0 border=1>
    <TBODY>
    <TR>
    <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>
    </TR>
    <TR>
    <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>
    </TR>
    <TR>
    <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>
    </TR>
    </TBODY>
    </TABLE>
    <TABLE BORDER="0">
    <TBODY>
    <TR>
    <TD><textarea id="abc" style="height:300;width:300"></textarea>
    </TD>
    <TD id="def"></TD>
    </TR>
    </TBODY>
    </TABLE>


    </BODY></HTML>


    Something gets lost when I paste that inot notepad,
    here, have it direct and change the extension to .html
    Attached Files Attached Files
    Last edited by rubenbuhr; 11-09-2006 at 11:49 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •