469,306 Members | 1,850 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Use the value of name to an html button onclick click function.

200 100+
Good day,

I need to use the value of the name to an html button onclick click function.

Expand|Select|Wrap|Line Numbers
  1. <xsl:element name="asp:CheckBox">
  2.    <xsl:attribute name='id'><xsl:value-of select='@name' /></xsl:attribute>     
  3.    <xsl:attribute name='runat'>server</xsl:attribute>
  4. </xsl:element>
  5.  
  6. <input id="btnDone" type="button" value="Done" onClick="@name.click();">
I want to onclick the button click the checkbox.
This does not work onClick="@name.click();"
but say the id of the checkbox = Test then onClick="Test.click();" works

Please help!
Oct 15 '09 #1
4 3280
Dormilich
8,651 Expert Mod 8TB
@ismailc
simple reason, the XPath expression (@name) only works on elements whose attribute value is parsed as such. i.e. the expression must be a) placed in an XSL element and b) the attribute denotes an XPath expression (select, match, test, …)

the best solution IMHO would be an external Javascript file (i.e. resign from using inline Javascript).
Oct 15 '09 #2
ismailc
200 100+
I got it going :)
Thank You

Expand|Select|Wrap|Line Numbers
  1. {@name}.click();
  2.  
Oct 15 '09 #3
Dormilich
8,651 Expert Mod 8TB
@ismailc
right… didn’t remember ’cause I hardly use those (despite the fact I don’t use inline Javascript either)
Oct 15 '09 #4
ismailc
200 100+
Thank You for helping :)
Oct 15 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by MickG | last post: by
11 posts views Thread by Brian D | last post: by
5 posts views Thread by siaj | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.