Web Technology Slip 21Write a java script code to accept the values of x and y and then display xyAnswer : <!DOCTYPE html> <html> <head> <script> function calcPower() { var b = document.getElementById("pow").value; var e = document.getElementById("exp").value; var res; res = PowerOfNumber(b,e); document.getElementById("res").innerHTML = res; } function PowerOfNumber(b,e){ var i, pow = 1; for(i=0; i<e; i++){ pow = pow*b; } return pow; } </script> </head> <body> <input type="number" id="pow" placeholder="Base" > <input type="number" id="exp" placeholder="Exponent" > <button type="submit" onclick="calcPower()">Submit</button> Result: <span id="res"></span> </body> </html> Copy Answer : <!DOCTYPE html> <html> <ol type="1"> <li>Coffee</li> <li>tea <ol type="a"> <li>Green Tea</li> <li>Black Tea <ol type="i"> <li>Africa</li> <li>China</li> </ol> </li> </ol> <li>Milk</li> </li> </ol> </body> </html> Copy
No comments:
Post a Comment