Why can't I pass in the name of the ID through the function so I can traverse the DOM looking for it and append to it where necessary?
Which gets called about 2 dozen times, each referencing a different block of notes (new element ID):Code:function makeNotes(id) { var theNote= prompt('Please enter note information', ' '); var insertText = document.createTextNode(theNote); var theBR = document.createElement('br'); document.getElementById(id).appendChild(insertText); document.getElementById(id).appendChild(theBR); }
But of course simply saying...Code:<a href="#" onClick="makeNotes('previousNotes')">Add Comments</a>
...works perfectly. Anyone? Please help!Code:document.getElementById('previousNotes').appendChild(insertText);





Bookmarks