Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Reference a column name in xsl from within JavaScript

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 6/15/2007 1:46:00 PM

Doogie wrote:

>        <tr onclick="GetDetail(this.rowIndex)">
>              <td><xsl:value-of select="@trip_status"/></td>
>              <td><input name="test" type="checkbox"></input></td>
>        </tr>
>    </xsl:for-each>
> 
> My problem is that I now need to pass in the column name that was
> clicked (i.e. either the trip status or accepted trips checkbox) into
> the GetDetail javascript method referenced in the onClick attribute
> above.  I cannot figure out how to reference that name.  I've tried
> this.colName, this.name, etc with no luck.

That is not really a problem with XSLT as you simply generate a HTML 
document with client-side script and need to learn how to use DOM 
scripting and event handling. To solve the problem you need to use the 
event object and check its srcElement property for IE and the target 
property for other browsers e.g.
   <tr onclick="GetDetails(this, event);">
then have a function
   function GetDetails (row, evt) {
     var srcElement = evt.srcElement || evt.target;
then extract the details from srcElement you are looking for.
If you have further questions then ask them in one of the J(ava)Script 
scripting groups.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent