Web Technology Slip 6

Q1. Write java script program to accept a number from user and check whether it is prime number or not.

Answer:

<html>
<head>
<script>
function saurabh()
{
var num, i;
num = Number(document.getElementById('M').value);
for(i=2; i<num; i++)
{
if(num%2==0)
{
break;
}
}
if(i==num)
{
alert(num + "is prime");
}
else
{
alert(num + "is not prime");
}
}
</script>
</head>
<body>
<input type="text" id="M">
<button onclick="saurabh()">click</button>
</body>
</html

Q2. Write a HTML code to display calendar of current month in tabular format. Use proper color for week days and holidays.  Display month name, year and images as advertisement at the beginning of the calendar.

Answer : 

<HTML>
<HEAD>
<TITLE> Calendar </TITLE>
</HEAD>

<BODY>
<img src="1.png" height="80" width="475" border="5">
<TABLE Cellpadding="10" border="10" cellspacing="10">
<CAPTION> <H1> <img src="1.png" height="40" width="70" border="1" align="left">January 2020 <img src="1.png" height="40" width="70" border="1" align="right"></H1></CAPTION>

<TR>
<TH><font color="red">SUN</font></TH>
<TH>MON</TH>
<TH>TUS</TH>
<TH>WED</TH>
<TH>THU</TH>
<TH>FRI</TH>
<TH>SAT</TH>
</TR>

<TR>
<TH> </TH>
<TH> </TH>
<TH> </TH>
<TH>1</TH>
<TH>2</TH>
<TH>3</TH>
<TH>4</TH>
</TR>

<TR>
<TH><font color="red"><b>5</font></TH>
<TH>6</TH>
<TH>7</TH>
<TH>8</TH>
<TH>9</TH>
<TH>10</TH>
<TH>11</TH>
</TR>

<TR>
<TH><font color="red"><b>12</font></TH>
<TH>13</TH>
<TH>14</TH>
<TH>15</TH>
<TH>16</TH>
<TH>17</TH>
<TH>18</TH>
</TR>

<TR>
<TH><font color="red"><b>19</font></TH>
<TH>20</TH>
<TH>21</TH>
<TH>22</TH>
<TH>23</TH>
<TH>24</TH>
<TH>25</TH>
</TR>

<TR>
<TH><font color="red"><b>26</font></TH>
<TH>27</TH>
<TH>28</TH>
<TH>29</TH>
<TH>30</TH>
<TH>31</TH>
<TH> </TH>
</TR>

</TABLE>
</BODY>
</HTML>
Web Technology Slip 6 Web Technology  Slip 6 Reviewed by technical_saurabh on December 21, 2020 Rating: 5

No comments:

Powered by Blogger.