01-20-2012, 05:56 AM
aslam-o-alikam
cs101 assignment no 4 complete solution
[HTML]<HTML>
<HEAD>
<script>
function ValidateStartField()
{
var chk = /^\d+$/.test(document.forms["mubeen"]["start"].value);
if (!chk)
{
window.alert("Please Enter Numeric Value in start field");
document.forms["mubeen"]["start"].value="";
document.forms["mubeen"]["start"].focus();
return false;
}
var x=document.forms["mubeen"]["start"].value;
if (x==0 || x=="" || x<2 || x>20)
{
window.alert("The value of Start field should be between 2 to 20");
document.forms["mubeen"]["start"].value="";
document.forms["mubeen"]["start"].focus();
return false;
}
else
{
return true;
}
}
function ValidateEndField()
{
var chk = /^\d+$/.test(document.forms["mubeen"]["end"].value);
if (!chk)
{
window.alert("Please Enter Numeric Value in end field");
document.forms["mubeen"]["end"].value="";
document.forms["mubeen"]["end"].focus();
return false;
}
var x=document.forms["mubeen"]["end"].value;
if (x==0 || x=="" || x<1 || x>20)
{
window.alert("Please Enter Value Greater then Zero");
document.forms["mubeen"]["end"].value="";
document.forms["mubeen"]["end"].focus();
return false;
}
}
function ValidateSizeField()
{
var chk = /^\d+$/.test(document.forms["mubeen"]["size"].value);
if (!chk)
{
window.alert("Please Enter Numeric Value in size field");
document.forms["mubeen"]["size"].value="";
document.forms["mubeen"]["size"].focus();
return false;
}
else if (document.forms["mubeen"]["size"].value<0 )
{
window.alert("Please Enter Value Greater then Zero");
document.forms["mubeen"]["size"].value="";
document.forms["mubeen"]["size"].focus();
return false;
}
else if (document.forms["mubeen"]["size"].value>20 || document.forms["mubeen"]["size"].value <2 )
{
window.alert("The value of Size field should be between 2 to 20");
document.forms["mubeen"]["size"].value="";
document.forms["mubeen"]["size"].focus();
return false;
}
else
{
true;
}
}
function DisplyTable()
{
var a=document.forms["mubeen"]["start"].value;
var b=document.forms["mubeen"]["end"].value;
var z1=document.forms["mubeen"]["size"].value;
m=parseInt(a);
u=parseInt(b);
b=parseInt(z1);
u=u+1;
b=b+1
document.write('<center><table width="80" border="0"> ');
document.write('<tr>');
var c=1;
for (i=a;i<u;i++)
{
document.write('<td>');
document.write('<center><table width="20" border="1"> Table of '+i+'');
document.write('<tr>');
for (j=1;j<b;j++)
{
document.write('<td>' +i+ '</td>');
document.write('<td>*</td>');
document.write('<td>' +j+ '</td>');
document.write('<td>=</td>');
document.write('<td><b>' +i*j+ '</b></td>');
document.write('</tr>');
}
document.write('</table></center>');
document.write('</td>');
c=c+1;
if (c>4)
{
document.write('</tr>');
c=1;
}
}
document.write('</tr>');
document.write('</table></center>');
}
function GenerateTables()
{
if (!ValidateStartField()||!ValidateEndField()||!ValidateSizeField() )
{
}
if (ValidateStartField()&&ValidateEndField()&&ValidateSizeField() )
{
}
else
{
DisplyTable();
}
}
</script>
</head>
<body>
<form name="mubeen" id="mubeen" method="post" action="">
<p align="center"><b><font size="7">Fall assignment No::: 4_2011 (CS101)</font></b></p>
<p> </p>
<table border=2 align=center cellpadding=6 width="280">
<tr>
<td><p align="right"><b>Start:</b></td>
<td><input name="start" type="text" onChange="ValidateStartField()" ></td>
</tr>
<tr>
<td>
<p align="right"><b>End: </b></td>
<td><input name="end" type="text" onChange="ValidateEndField()" ></td>
</tr>
<tr>
<td><p align="right"><b>Depth/Size:</b></td>
<td><input name="size" type="text" onChange="ValidateSizeField()" ></td>
</tr>
<tr>
<td></td>
<td><input name="Generate Tables" type="button" onClick="GenerateTables()" value="Generate Tables" ></td>
</tr>
</table>
</form>
</center>
<p> </p>
<p> </p>
<p align="center"><font color="#FF0000" size="5"><b>Composed: by Mubeen Mehmood</b></font></p>
<p align="center"><b><a href="mailto:Mubeenmehmood@gmail.com">
<font color="#FF0000" size="5">Mubeenmehmood@gmail.com</font></a></b></p>
<p align="center"><font color="#FF0000" size="5"><b>Id: MC110401647</b></font></p>
</body>
</html>[/HTML]
cs101 assignment no 4 complete solution
[HTML]<HTML>
<HEAD>
<script>
function ValidateStartField()
{
var chk = /^\d+$/.test(document.forms["mubeen"]["start"].value);
if (!chk)
{
window.alert("Please Enter Numeric Value in start field");
document.forms["mubeen"]["start"].value="";
document.forms["mubeen"]["start"].focus();
return false;
}
var x=document.forms["mubeen"]["start"].value;
if (x==0 || x=="" || x<2 || x>20)
{
window.alert("The value of Start field should be between 2 to 20");
document.forms["mubeen"]["start"].value="";
document.forms["mubeen"]["start"].focus();
return false;
}
else
{
return true;
}
}
function ValidateEndField()
{
var chk = /^\d+$/.test(document.forms["mubeen"]["end"].value);
if (!chk)
{
window.alert("Please Enter Numeric Value in end field");
document.forms["mubeen"]["end"].value="";
document.forms["mubeen"]["end"].focus();
return false;
}
var x=document.forms["mubeen"]["end"].value;
if (x==0 || x=="" || x<1 || x>20)
{
window.alert("Please Enter Value Greater then Zero");
document.forms["mubeen"]["end"].value="";
document.forms["mubeen"]["end"].focus();
return false;
}
}
function ValidateSizeField()
{
var chk = /^\d+$/.test(document.forms["mubeen"]["size"].value);
if (!chk)
{
window.alert("Please Enter Numeric Value in size field");
document.forms["mubeen"]["size"].value="";
document.forms["mubeen"]["size"].focus();
return false;
}
else if (document.forms["mubeen"]["size"].value<0 )
{
window.alert("Please Enter Value Greater then Zero");
document.forms["mubeen"]["size"].value="";
document.forms["mubeen"]["size"].focus();
return false;
}
else if (document.forms["mubeen"]["size"].value>20 || document.forms["mubeen"]["size"].value <2 )
{
window.alert("The value of Size field should be between 2 to 20");
document.forms["mubeen"]["size"].value="";
document.forms["mubeen"]["size"].focus();
return false;
}
else
{
true;
}
}
function DisplyTable()
{
var a=document.forms["mubeen"]["start"].value;
var b=document.forms["mubeen"]["end"].value;
var z1=document.forms["mubeen"]["size"].value;
m=parseInt(a);
u=parseInt(b);
b=parseInt(z1);
u=u+1;
b=b+1
document.write('<center><table width="80" border="0"> ');
document.write('<tr>');
var c=1;
for (i=a;i<u;i++)
{
document.write('<td>');
document.write('<center><table width="20" border="1"> Table of '+i+'');
document.write('<tr>');
for (j=1;j<b;j++)
{
document.write('<td>' +i+ '</td>');
document.write('<td>*</td>');
document.write('<td>' +j+ '</td>');
document.write('<td>=</td>');
document.write('<td><b>' +i*j+ '</b></td>');
document.write('</tr>');
}
document.write('</table></center>');
document.write('</td>');
c=c+1;
if (c>4)
{
document.write('</tr>');
c=1;
}
}
document.write('</tr>');
document.write('</table></center>');
}
function GenerateTables()
{
if (!ValidateStartField()||!ValidateEndField()||!ValidateSizeField() )
{
}
if (ValidateStartField()&&ValidateEndField()&&ValidateSizeField() )
{
}
else
{
DisplyTable();
}
}
</script>
</head>
<body>
<form name="mubeen" id="mubeen" method="post" action="">
<p align="center"><b><font size="7">Fall assignment No::: 4_2011 (CS101)</font></b></p>
<p> </p>
<table border=2 align=center cellpadding=6 width="280">
<tr>
<td><p align="right"><b>Start:</b></td>
<td><input name="start" type="text" onChange="ValidateStartField()" ></td>
</tr>
<tr>
<td>
<p align="right"><b>End: </b></td>
<td><input name="end" type="text" onChange="ValidateEndField()" ></td>
</tr>
<tr>
<td><p align="right"><b>Depth/Size:</b></td>
<td><input name="size" type="text" onChange="ValidateSizeField()" ></td>
</tr>
<tr>
<td></td>
<td><input name="Generate Tables" type="button" onClick="GenerateTables()" value="Generate Tables" ></td>
</tr>
</table>
</form>
</center>
<p> </p>
<p> </p>
<p align="center"><font color="#FF0000" size="5"><b>Composed: by Mubeen Mehmood</b></font></p>
<p align="center"><b><a href="mailto:Mubeenmehmood@gmail.com">
<font color="#FF0000" size="5">Mubeenmehmood@gmail.com</font></a></b></p>
<p align="center"><font color="#FF0000" size="5"><b>Id: MC110401647</b></font></p>
</body>
</html>[/HTML]


mileys81: