PROMOTE MY BLOG: JUST CLICK BELOW BUTTON

Search Any Paper On This Blog

Wednesday, January 18, 2012

Re: ::: vuaskari.com ::: CS101 4th Assignment Solution :p

i have checked... InshAllah 10/10 for this code.

Please try to add comments in code file.


==============================================================
Imran Ali,
MBA 4th (Finance),
"The Hardest Part About Losing Love;  IS FINDING YOUR WAY BACK".
===============================



On Wed, Jan 18, 2012 at 6:16 PM, Noman Malik <nomanmalik8@yahoo.com> wrote:
<html>
<head>
<script>

function ValidateStartField(){
txt = document.getElementById("startfield").value ;
var x = parseInt(txt);

if (x>=2 && x <=20){

}
else if (x<2 || x>20){
alert("the value of start field must lie between 2 and 20");
document.getElementById("startfield").value = " ";
document.getElementById("startfield").focus();
return false;
}
else{
alert("please enter NUMBER in start field");
document.getElementById("startfield").value = " ";
document.getElementById("startfield").focus();
return false;
}


}

function ValidateEndField(){

var x = parseInt(document.getElementById("endfield").value);
var y = parseInt(document.getElementById("startfield").value);

if (x < y ){
alert("please enter value greater than start-field in end-field");
document.getElementById("end").value = " ";
document.getElementById("end").focus();
return false;

}

else if (x>=2 && x <=20){

}
else if (x<2 || x>20){
alert("the value of End-field must lie between 2 and 20");
document.getElementById("endfield").value = " ";
document.getElementById("endfield").focus();
return false;

}
else{
alert("please enter Number in End field");
document.getElementById("endfield").value = " ";
document.getElementById("endfield").focus();
return false;


}

}

function ValidateSizeField(){
var x = parseInt(document.getElementById("depthfield").value);

if (x>=2 && x <=20){

}
else if (x<2 || x>20){
alert("the value of size field must lie between 2 and 20");
document.getElementById("depthfield").value = " ";
document.getElementById("depthfield").focus();
return false;

}
else{
alert("please enter Number in size field");
document.getElementById("depthfield").value = " ";
document.getElementById("depthfield").focus();
return false;
}

}

function generatetable(){
var s = parseInt(document.getElementById("startfield").value);
var e = parseInt(document.getElementById("endfield").value);
var d = parseInt(document.getElementById("depthfield").value);
var counter = 0;


document.write("<table border=1 align=center>");
document.write("<tr>");

for (o=s;o<=e;o=o+1){


document.write("<td>");

document.write("<table border=1 cellpadding=2>");
document.write("<caption><b> Table of " + o + "</b></caption>");
for (i = 1;i<=d;i=i+1){

document.write("<tr>");
document.write("<td>");
document.write(o);
document.write("</td>");

document.write("<td>");
document.write(" x ");
document.write("</td>");

document.write("<td>");
document.write(i);
document.write("</td>");

document.write("<td>");
document.write(" = ");
document.write("</td>");


document.write("<td>");
document.write("<b> " + o*i + "</b>");
document.write("</td>");

document.write("</tr>");

}
document.write("</table>");
document.write("</td>");

counter = counter + 1;

if (counter == 4){
document.write("</tr>");
counter = 0;
}


}
return false;
document.write("</tr>");
document.write("</table>");

}

</script>

</head>


<body>
<h1 align=center>Fall 2011::Assignment 4(CS101)</h1>
<form name="formasd">
<table align=center border=1>
<tr>
<td align=right><b> Start: </b></td>
<td> <input type=text name=startfield 
id=startfield onchange=ValidateStartField()>
<font color=red> * </font> </td>
</tr>

<tr>
<td align=right><b> End: </b></td>
<td> <input type=text name=endfield 
id=endfield onchange=ValidateEndField()>
<font color=red> * </font> </td>
</tr>

<tr>
<td align=right><b> Depth/Size: </b></td>
<td> <input type=text name=depthfield 
id=depthfield onchange=ValidateSizeField()>
<font color=red> * </font> </td>
</tr>

<tr>
<td> </td>
<td align="center"> <input type=button name=generate
value="Generate Table" onclick=generatetable()>
</td>

</tr>
</table>
</form>
</body>
</html>
________________________________________________________________________________________
Remember me and my Parents in your Prayers 
 
Noman Malik

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en

No comments:

Post a Comment

PLEASE COMMENT ABOUT YOUR VISIT AND MY SITE

Note: Only a member of this blog may post a comment.