1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<!DOCTYPE html> <html> <head> <title>Nested table</title> </head> <body> <table border="1"> <tr> <th>id</th> <th>name</th> <th>mark</th> </tr> <tr> <td>1</td> <td>bishal</td> <td>50</td> </tr> <tr> <td>2</td> <td>bijay</td> <td> <table border="1"> <tr> <th>theory</th> <th>practical</th> </tr> <td>40</td> <td>60</td> </table> </td> </tr> </table> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<head> <title>JavaScript</title> </head> <body> <script> function SumOfArray(array){ var sum = 0; for(var i = 0 ; i < array.length;i++ ){ if(array[i]%5==0 && array[i]%9==0){ sum+=array[i]; } } console.log("the sum is "+sum) } sumOfArray([1,2,4,5,6]); </script> </body> </html> |
Q.NO) 14 source code to display the following code using divs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
<head> <title>div design</title> </head> <style> div{ text-align: center; color: white; justify-items: center; align-items: center; } .main{ width:400px; height:400px; } .div1{ width:400px; height:20px; background-color: green; } .div2{ width:400px; height:20px; background-color: rgb(24, 10, 184); } .div3{ height:340px; width:200px; float:left; background-color: yellow; } .div4{ height:340px; width:200px; float:right; background-color: rgb(25, 174, 190); } .div5{ width:400px; background-color: rgb(30, 28, 25); } </style> <body> <div class="main"> <div class="div1">This is header</div> <div class="div2">This is Nagivation bar</div> <div class="div3">left content</div> <div class="div4">right content</div> <div class="div5">this a footer</div> </div> </body> </html> |
Q.No 15) Source code to design and validate the form below. Assume all the required validation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
<head> <title>Document</title> </head> <body> <form name="validate"> <table border="1"> <tr> <td>Name</td> <td><input type="text" name="name" id="name"></td> </tr> <tr> <td>Email</td> <td><input type="text" name="email" id="email"></td> </tr> <tr> <td>Zip Code</td> <td><input type="number" name="zip" id="zip"></td> </tr> <tr> <td>Country</td> <td> <select name="country" id="country"> <option value="-1">choose yours</option> <option value="nepal">nepal</option> <option value="india">india</option> </select> </td> </tr> <tr> <td></td> <td><button name="submit" id="submit">submit</button></td> </tr> </table> </form> <script> var button = document.querySelector('#submit') button.addEventListener('click',function(e){ e.preventDefault(); var name = document.getElementById('name').value var email = document.getElementById('email').value var zip = document.getElementById('zip').value var country = document.getElementById('country').value var nameregex = /[a-zA-Z]+$/ var emailregex = /[^0-9]+@gmail\.[com]$/ var zipregex = /[0-9]{10}$/ if(name.match(nameregex) && email.match(emailregex) && zipregex.match(zipregex) &&country! =-1 ){ alert('validation sucess') } }) </script> </body> </html> |