Hi, I'm having a problem utilizing the DOM. I tried using my own
code, but it wasn't working, so I tried to use code straight from
another web site and it verified that the problem may not be mine. I
am using IE 6.0.28 (sp5) on a Windows 2000 Server.
I am very new to DOM so I'm not ruling out that I'm doing something
wrong. However, I am posting the code that I got from another site
because I did notice that the examples were using Netscape. I'm
curious to know if there are differences between Netscape and IE for
DOM? Anyway the site that the code came from is
http://www-106.ibm.com/developerwork...jsdom/#figure2
and seems like it should work. I'm hoping somebody can help. Thank
you in advance.... Chris
<%@ Language=VBScript %>
<html>
<head>
<title>Getting Sticky</title>
<style type="text/css">
* {font-family: sans-serif}
a {font-size: 6pt}
.editButton {font-size:6pt}
</style>
<script type="text/javascript">
function getCurrentNumber() {
formElement = document.getElementById("noteForm");
return formElement.childNodes.item(1).value;
}
function makeNewNote(){
mainDivElement = document.getElementById("mainDiv");
newNote = document.createElement("div");
newNote.setAttribute("id", "note"+getCurrentNumber());
mainDivElement.appendChild(newNote);
noteForm.total.value= parseInt(noteForm.total.value) + 1;
}
</script>
</head>
<body>
<div id="mainDiv" style="height:85%; width:85%; border:3px solid
red;
padding: 10px; z-index:
-100" >
<h1>Getting Sticky</h1>
<form id="noteForm">
Current number of notes
<input type="text" name="total" value="0"size="3"/>
<input type="button" value="Add a new note"
onclick="makeNewNote()" />
</form>
<div id="addhere"> </div>
</div>
</body>
</html>