Useful Resources
syllabus | schedule | exercises | assignments | class notes | resources | students | ARTC courses
Javascript - innerHTML

Description:

innerHTML references the html inside of an element

The Code:

<head>
      <script type="text/javascript">
            function changeContents(msg) {
                  document.getElementById('myDiv').innerHTML = msg;
            }
      </script>
</head>

<body>
      <a href="#" onmouseup="changeContents('test');">Changes the content to "test"</a><br />
      <a href="#" onmouseup="changeContents('pizza');">Changes the content to "pizza"</a>


      <div id="myDiv">
            Contents of my div.
      </div>
</body>

[BACK to RESOURCES]