Web Technology Slip 23Write a java script code to accept a number and write a function to calculate sum of digits of that number Answer : <html> <head> <script> function saurabh() { var num,sum=0,i,str; num = Number(document.getElementById('v').value); str = num.toString(); for (i=0; i<str.length; i++) { sum += parseInt(str.charAt(i)); } alert(sum); } </script> </head> <input id="v"> <button onclick="saurabh()">click</button> </html> CopyWrite HTML code to create following table. (use External CSS to format the table)Answer : <!DOCTYPE html> <html> <body> <table width="50%" align="left" cellpadding="1" cellspacing="1" border="1"> <tr align="center"> <td rowspan="2">Course</td> <td colspan="3">Fees Structure</td> <td rowspan="2">Year</td> </tr> <tr align="center"> <td>FY</td> <td>SY</td> <td>TY</td> </tr> <tr> <td>B.Sc.(CS)</td> <td>20000</td> <td>25000</td> <td>30000</td> <td>2017</td> </tr> <tr> <td>BCA(Sci)</td> <td>15000</td> <td>20000</td> <td>25000</td> <td>2018</td> </tr> <tr> <td>BBA(CA)</td> <td>25000</td> <td>30000</td> <td>35000</td> <td>2019</td> </tr> </table> </body> Copy
No comments:
Post a Comment