You need to use the 'value' attribute on the textarea (not innerHTML).
Furthermore, you need to access it AFTER the page has loaded, not
before. So, you need to put it in a function that is executed after
the page has loaded. So, the following won't work at all...
<script type="text/javascript">
<!--
document.getElementById('taMyText').value = 'asdfsdf';
// -->
</script>
This is what you want...
<script type="text/javascript">
<!--
window.onload = function(evt) {
document.getElementById('taMyText').value = 'asdfsdf';
}
// -->
</script>
Given this xhtml:
<textarea id="taMyText"></textarea>
Werner wrote:
Hello,
how can fill automatically a textarea when opening a webpage.
I want to do this by a function that has been raised in js file.
thx