Js3.html

<html> <script> function numberSum(N) { var total = 0; for(var i = 1; i <= N; i++){ total += i; } return total; } function run(){ val = document.getElementById("val").value; document.getElementById("results").innerHTML="Sum is "+numberSum(val) } </script> <body> Enter Value<input id="val"> <input type="Submit" onclick="run();"> <p id="results"></p> </body> </html>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.