Associate
- Joined
- 29 Mar 2004
- Posts
- 593
- Location
- Cambs, UK
Hi folks,
Im currently coding a website, and doing the cms part at the moment.
Im having problems with adding content into my textarea input.
What im trying to do is when i click on a link, it adds the text into the textarea. I have it working fine when the link is in the same page as the textarea, but i was wondering how i refer to the textarea that is in a different page, for example.
document 1 has a textarea in it.
document 2 has a load of links in it.
When i click a link in document 2, i want the text to be added to the textarea in document 1.
Im using an iframe in document 1 that displays all the links in document 2.
The code i am using to add text to the textarea is as follows.
What im trying to find out is how to reference a different document, where i use it in the javascript.
Does anyone know, if so, could you please enlighten me.
Thank you,
Edward
Im currently coding a website, and doing the cms part at the moment.
Im having problems with adding content into my textarea input.
What im trying to do is when i click on a link, it adds the text into the textarea. I have it working fine when the link is in the same page as the textarea, but i was wondering how i refer to the textarea that is in a different page, for example.
document 1 has a textarea in it.
document 2 has a load of links in it.
When i click a link in document 2, i want the text to be added to the textarea in document 1.
Im using an iframe in document 1 that displays all the links in document 2.
The code i am using to add text to the textarea is as follows.
PHP:
<html>
<head>
<script language="javascript">
function addtext(newtext)
{
document.add.content.value=document.add.content.value+=newtext;
}
</script>
</head>
<body>
<?php
$path="./images/work";
$images=opendir($path);
while(($file=readdir($images)) !==false)
{
if($file=="." || $file=="..")
{
}
else
{
echo "<a href='$path/$file' target='_blank'><img src='$path/$file' width='50'/></a>";
echo "<a href=javascript:addtext('picture');>$file</a><br/>";
}
}
closedir($images);
?>
</body>
</html>
What im trying to find out is how to reference a different document, where i use it in the javascript.
Does anyone know, if so, could you please enlighten me.
Thank you,
Edward