Im just learning javascript and I m just wondering why this doesn t work. I ve created a button and when it is clicked I assigned a function which is supposed to append some text to all my paragraphs. I don t know why it doesn t work:
<html>
<head>
<title>javascript test</title>
</head>
<body>
<script language="javascript" type="text/javascript">
function appendStuff(){
var node = document.getElementsByTagName("P");
node.appendChild.createTextNode( Here s some text );
return true;
}
</script>
<noscript>
Your browser doesn t support javascript.
</noscript>
<input type="submit" value="click me" onclick="appendStuff();" />
<p>
This is the first paragraph.
</p>
<p>
This is the second paragraph.
</p>
<p>
This is the third paragraph.
</p>
</body>
</html>