View Single Post
Old 05-05-2012, 03:04 AM   PM User | #5
Taro
Regular Coder

 
Taro's Avatar
 
Join Date: Oct 2011
Location: Geraldton, Ontario
Posts: 155
Thanks: 1
Thanked 1 Time in 1 Post
Taro is an unknown quantity at this point
Improved version (previous version still acceptable):
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>Untitled</title>

<script type="text/javascript">
"use strict";
function sb()
{
  var TB = document.getElementById('myDiv');
  if (!TB) {
    throw new Error("The element with the ID 'myDiv' does not exist.");
  }
  TB.innerHTML = "This is something placed into the div tag";
}//end of function
</script>

</head>
<body>

<button onclick="sb()">Show text</button>


<div id="myDiv"></div>
</body>
</html>
I decided not to add the inline js (but made 'onclick' lower-case); I received an error from HTML-Kit saying that it does not exist (non-syntax error).
__________________
Element ID

Webs Support Helper

Your friendly neighborhood Taroman.

Last edited by Taro; 05-05-2012 at 06:49 PM..
Taro is offline   Reply With Quote