| |

VerySource

 Forgot password?
 Register
Search
View: 20|Reply: 3

xslt variable into js

[Copy link]

1

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-2-13 11:30:02
| Show all posts |Read mode
In the same xslt:
I have defined a variable <xsl: variable name = "catId" select = "catId" />

This variable is used later:
<a href="javascript:" onclick="docat(<xsl:value-of select="$catId" />); "> do </a>

The above sentence should be wrong. How should it be written?

thanks!
Reply

Use magic Report

0

Threads

28

Posts

17

Credits

Newbie

Rank: 1

Credits
17

 China

Post time: 2020-4-11 07:15:01
| Show all posts
<a href="javascript:void()">
<xsl: attribute name = "onclick">
docat (<xsl: value-of select = "$ catId" />);
</ xsl: attribute>
Do </a>

or

<a href="javascript:" onclick="docat($catId);"> Do </a>

Note: If catId is not a number, please
<a href="javascript:" onclick="docat('$catId');"> Do </a>

or
docat ('<xsl: value-of select = "$ catId" />');
Reply

Use magic Report

1

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: 2020-4-11 11:00:01
| Show all posts
Thanks, just tried it, docat ('<xsl: value-of select = "{$ catId}" />');
is ok

thanks
Reply

Use magic Report

1

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: 2020-4-11 12:15:02
| Show all posts
Wrong sent, it should be docat ({$ catId});
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list