- Just put formless buttons on the page. Ie buttons that are not in forms. For instance
<button id="ss" type="submit" onclick="function1();">Function 1</button>
- As shown above, specify the onclick action to be the name of one of your functions.
- Create empty "div"s into which you will put the result of your functions. For instance
<div id="f1result"></div>
Rather than putting everything in divs, maybe use h1, h2, h3 and h4, so span or p or .... elements?
- Reminder. You can put Javascript functions and code directly between script tags. For instance this will work
<script>
function ff() { return 6*3; }
</script>
You can also put javascript into a separate file that is specified in the script tag.
<script src="./myjavascript.js"></script>
- Debugging javascript is really annoying; but there is some help. Within your browser of choice you should definitely open the "javascript console". For instance, in firefox this can be found from the "tools" menu; select "browser tools" then "web developer tools". When javascript goes bad you can get stack traces (or at least the top item in the stack). You can also send logging statements to the javascript console by using the console.log() function.