471,578 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,578 software developers and data experts.

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 3362
Dormilich
8,656 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,656 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
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
1 post views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.