"Brad Esclavon" <gtg724h@mail.gatech.edu> writes:
[color=blue]
> i am creating a page that creates 10-45 text input areas dynamically in a
> for loop. all the fields will be identical except for content, and i need a
> button to clear each corresponding field individually(also dynamically
> created). i have tried to do it various ways, but i cant get the proper
> object declared, i always get object does not exist or object undefined
> errors. I dont even know what this is called so that i can look it up. im
> kind of lost as how to solve it.
>
> below is my code[/color]
[color=blue]
> <script language="JavaScript">[/color]
It's
<script type="text/javascript">
in HTML 4 and later.
[color=blue]
> <!--[/color]
You don't need HTML comments in Javascript.
[color=blue]
> // num is the number corresponding to the appropiate textarea
> // function makeblank(num)[/color]
This line shouldn't be commented out?
[color=blue]
> {
> titlenum='txt' + num.toString();
> var txt = document.form1.txtnum;[/color]
Is it "titlenum" or "txtnum"?
[color=blue]
> txt.value="";
> }
> //-->
> </script>[/color]
What you probably need is:
---
<script type="text/javascript">
function makeblank(num)
{
document.forms['form1'].elements['txt'+num].value="";
}
</script>
---
/L
--
Lasse Reichstein Nielsen -
lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'