Thursday, 3 July 2014

Lecture # 09

Following Topics were covered in Ninth Lecture:
  • JavaScript (Add, Subtract, Multiply, Divide)
  • JavaScript (if-else-Grade Calculator)
  • HTML5 Form with Table

Example 1:

<!DOCTYPE html>
<html>
<head>

<script type="text/javascript">
var num1=prompt("Enter first number : ");
var num2=prompt("Enter second number : ");

var pro=num1*num2;
var dif=num1-num2;
var div=num1/num2;
var sum=parseInt(num1) + parseInt(num2);

document.write("num1 is " + num1);
document.write("<br/>num2 is " + num2);

document.write("<br/>The product is " + pro);
document.write("<br/>The difference is " + dif);
document.write("<br/>The quotient is " + div);
document.write("<br/>The sum is " + sum);

</script>

</head>

<body>
</body>
</html>



Example 2:

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

var per=prompt("Enter your percentage : ");

if (per>80)
{
 document.write("A+ grade");
}
else if (per>70)
{
 document.write("A Grade");
}
else if (per>60)
{
 document.write("B grade");
}
else
{
 document.write("You are papu bacha.");
}
</script>
</head>
</html>

Example 3:

<!DOCTYPE html>
<html>
<body>
<table>
<form autocomplete="on">
<tr>
<td>First name : </td>
<td><input type="text" name="fname" > </td>
</tr>

<tr>
<td> Last name : </td>
<td> <input type="text" name="lname" autofocus> </td>
</tr>

<tr>
<td>Enter a number between 18 and 100 : </td>
<td> <input type="number" min="18" max="100"> </td>
</tr>

<tr>
<td>Select files to upload :</td> 
<td> <input type="file" multiple> </td>
</tr>

<tr>
<td>Enter your email Id : </td>
<td> <input type="email" placeholder="abc@papu.com"> </td>
</tr>

<tr>
<td>Username : </td> 
<td><input type="text" required> </td>
</tr>

<tr>
<td>Enter a number multiple of 5 : </td>
<td> <input type="number" step="5"> </td>
</tr>

<tr>
<td> <input type="submit" value="Papu"> </td>
</tr>

</form>
</table>
</body>
</html>

No comments:

Post a Comment