javascript: dom manipulation

Functions that maniupulate the DOM by modifying a div with id ="one"

1.) execute "Go" here: adds an array of numbers to the div with id "one"

2.) execute "ClearAll" here: restores the div id = "one" to original state

Hide() - click here to hide 1.) above

Show() - click here to show 1.) above



The code below is the code that hides and shows the div ( id="one" ) above. Can you make the two functions into one "toggle" function? Can you PASS the "id" of the item to hide in as a parameter? <html> <head> <script type="text/javascript"> function hide() { var o = document.getElementById("one"); o.style.display='none'; // hide: 'none' and show: '' } function show() { var o = document.getElementById("one"); o.style.display=''; // hide: 'none' and show: '' } </script> </head>


Make a STYLE change to font color in a div (one, two, out, code)



Oops - the hide & show div is all gone...

Restore() - write the restore function to restore that div to its original state!