Thursday, 16 January 2020

WT-2


Slip 2

Write a java script program to accept a number form user and display its multiplication table
<html>
<body>
<script type='text/javascript'>
var num = prompt("Enter Number", "0") //prompt user to enter the number
var num = parseInt(num); //parse the num to number
var i = 0;
document.write('<table border="1" cellspacing="0">');
for(i=1;i<10;i++) {
document.write("<tr><td>" + num + " x " + i + " = " + num*i + "</td></tr>");
}
document.write("</table>");
</script>
</body>

</html>

Write the HTML code to create the following table. Use internal CSS to format the table

<html>
<head>
<style type="text/css">
body{background-color:pink;}
th{color:Blue;}
</style>
</head>
<body>
<table border=1>
 
<tr>
<th rowspan="2">Book No</th>
<th rowspan="2"">BookName</th>
<th colspan="2">Price</th>
</tr>

<tr>
<th>Rs.</th>
<th>Paise</th>
</tr>

<tr>
<td>101</td>
<td>DBMS</td>
<td>200</td>
<td>50</td>
</tr>

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