Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
106
rated 0 times [  113] [ 7]  / answers: 1 / hits: 34010  / 13 Years ago, sun, may 29, 2011, 12:00:00

i am trying to pass an xsl variable value to a javascript function.



My xsl variable



<xsl:variable name=title select=TITLE />


i'm passing the value like this



<input type=button value=view onclick=javascript:openPage('review.html?review=$title') />


i have tried the above code in different possible ways but i gets errors.



<script type=text/javascript>
function jsV() {
var jsVar = '<xsl:value-of select=TITLE/>';
return jsVar;
}
</script>

<input type=button value=view onclick=javascript:openPage('javascript:jsV()') />

I also tried

<input type=button value=view onclick=javascript:openPage('review.html?review='''
+$title+'') />


Is there alternative way or am i not doing it right?


More From » xslt

 Answers
13

You forgot about {}:



<input type=button value=view onclick=javascript:openPage('review.html?review={$title}') />

[#91995] Friday, May 27, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
amberlykaliac

Total Points: 415
Total Questions: 100
Total Answers: 85

Location: Wallis and Futuna
Member since Tue, Mar 30, 2021
3 Years ago
;