sappo
08-03-2005, 04:30 AM
Hi Guys,
I'm trying somethink that's new to me. I want to get the text in a textarea and display it live on the same page. This is what I have thought it's not working:
<!--
function bob()
{
var newText = document.getElementsByName("textarea").value();
var sap = document.getElementsByTagName("h1")[0];
sap.firstChild.nodeValue = newText;
}
-->
</script>
<form name="form1" id="form1" method="post" action="">
<p>
<textarea name="textarea1" id="textarea1" onchange="bob()"></textarea>
</p>
</form>
<p><h1>bob</h1></p>
Does anyone fancy fixing this for me? please?
Now as for the live update I thought I would use a setinterva() are there any better ways of doing this?
Thanks,
Sapl
I'm trying somethink that's new to me. I want to get the text in a textarea and display it live on the same page. This is what I have thought it's not working:
<!--
function bob()
{
var newText = document.getElementsByName("textarea").value();
var sap = document.getElementsByTagName("h1")[0];
sap.firstChild.nodeValue = newText;
}
-->
</script>
<form name="form1" id="form1" method="post" action="">
<p>
<textarea name="textarea1" id="textarea1" onchange="bob()"></textarea>
</p>
</form>
<p><h1>bob</h1></p>
Does anyone fancy fixing this for me? please?
Now as for the live update I thought I would use a setinterva() are there any better ways of doing this?
Thanks,
Sapl