This is surely a simple RTFM problem, but I still can't do it
The 'heading 2' click works fine, but I want to be able to set them all (to keep the body of the markup as simple as possible) but my code has no effect. No doubt it's a simple error...

Code:
<HTML> <BODY onLoad="loader()"> <SCRIPT LANGUAGE="JavaScript"> <!-- Hide code from older browsers function loader() { toc = document.getElementById("tableOfContents") for (i = 0; i < toc.all.length; i++) { if (toc.all[i].tagName == "H1") {toc.all[i].onclick="head()"} } } function head() { alert('hello mum') } // End hiding--> </SCRIPT> <!-- </form>--> <div id="tableOfContents"> <h1> here's a heading 1</h1> <h2 onclick="head()">here's a heading2</h2> </div> </BODY> </HTML>
Comment