Monday, 24 May 2021

WT-27

 Write a javascript function to compute the sum of factors of a input number

 <html>

<body>

<script>

function sum() {

var sum = 0, i, str,num1;

num1 = number(document.getelementbyid("n").value);

 str = num1.tostring();

sum = 0;

for (i = 0; i < str.length; i++) {

sum += parseint(str.charat(i), 10);

}

window.alert(sum);

}

</script>

</head>

<body>

enter a number : <input type="text" id="n"><br/>

<button onclick="sum()"> sum is </button>

<body>

</html>

              

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. 

  

<html>

<body>

 <table cellpadding="10" border="10" cellspacing="10"> <h1> <img src="1.png" height="40" width="70" border="1" align="left">january 2021 <img src="1.png" height="40" width="70" border="1" align="right"></h1>

 <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>