You might feel that this is funny article. I have given home-work for my sun-in-law of creating 99th table. He completed and gave that to me to verify then it became my problem to create 99th table and verify. Then I got this idea of creating this program.

Program Flow :

  1. Get inputs ( which table, what limit ) from User
  2. Format the table and display it

Markup :

<label>Which Math Table ?</label> <br/>
<input id="MathTable" value="99" name="MathTable" type="number" min="0" step="1" pattern="\d"/><br/>
<label>What is the limit</label><br/>
<input id="MathLimit" value="9" name="MathLimit" type="number" min="0" step="1" pattern="\d"/><br/>
<button id="MathButton" name="MathButton">Generate the table</button>
<div id="MathResult">
</div>

jQuery Code :

$(function(){
 $("#MathButton").click(function(){
     var mtb = $("#MathTable").val();
     var mtl = $("#MathLimit").val();
     var myhml = '';
     for(var i=1; i <= mtl; i++) {
         myhml = myhml + mtb +' X '+i+' = '+ (i*mtb) + '<br/>'; 
     }
     $("#MathResult").html(myhml);
 });
 $("#MathButton").click();
});

1 comment:

  1. thanks for sharing an informative post with us. keep sharing like it.
    chrome support

    ReplyDelete

Blogroll

Popular Posts