Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onclick passing parameters through a function

Status
Not open for further replies.

chebbi

Programmer
Feb 6, 2002
98
IN
Hi

Iam building a dynamic di tag with a onclick attribute inside a for loop. This onclcik attribute calls a function by sending 2 parameters.
for ex:

for (i=1;i<=9;i++)
{
var tempparam1=i;
document.write(&quot;<tr><td onclick=groupby(tempparam1)></td></tr>&quot;);

}
strangely everytime the groupby function receives the parameter as 9(last number in the loop) instead of diff numbers(0-9) for diff rows.

i tried (&quot;<tr><td onclick=groupby(&quot;+tempparam1+&quot;)&quot;></td></tr>&quot;
but in vain. Any ideas?

Badrinath Chebbi
 
Mera demak carab hei!! :)

for (i=1;i<=9;i++)
{
document.write(&quot;<tr><td onclick=groupby(&quot; + i + &quot;)></td></tr>&quot;);
}

Does that fix your problem?

Gary Haran
==========================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top