Aaron Gray wrote:
Whoops, forgot the question !
I want to copy the text from a text document opened in an iframe into a
textarea at th press of a button.
<iframe name="iframe" width="100%" height="25%" src="test1.txt" >
</iframe>
<a href="test1.txt " target="input"> one</a>
<a href="test2.txt " target="input"> two</a>
<form name="form1">
<textarea name="textarea" cols=80 rows=18>
This is a test
</textarea><br>
<button name="Copy" value="Copy" OnClick="DoCopy ()">Copy</button>
</form>
<script>
function DoCopy()
{
form1.textarea. value=iframe.in nerText;
}
</script>
I tried 'iframe.body.in nerText' but that did not work.
Aaron
<iframe name="iframe01" width="100%" height="25%" src="test1.txt" >
</iframe>
<form name="form1">
<textarea name="txt01" cols=80 rows=18>
This is a test
</textarea><br>
<button name="Copy" value="Copy" OnClick="DoCopy ()">Copy</button>
</form>
<script>
function DoCopy()
{
document.forms['form1'].elements['txt01'].value =
document.frames['iframe01'].document.body. innerHTML;
}
</script>
1) Never ever give the names/id using generic html element names
("iframe", "textarea" etc.)
2) <http://www.javascriptt oolbox.com/bestpractices/> see about
addressing frames/form elements - helps a lot.
;-)