逻辑:在XSL中获得XML中节点picPath的值例如:/templets/images/test.jpg|/templets/images/ad_1.gif|/templets/images/ad_2.jpg|声明变量
<xsl:variable name="picPath" select="picPath"/>将值传给JS函数<div onload="CutPic($picPath)">JS函数为
funtion CutPic(picPath)
{
}问题:无法将picPath的值传给JS函数CutPic()中请大虾们帮帮忙,在线等!
<xsl:variable name="picPath" select="picPath"/>将值传给JS函数<div onload="CutPic($picPath)">JS函数为
funtion CutPic(picPath)
{
}问题:无法将picPath的值传给JS函数CutPic()中请大虾们帮帮忙,在线等!
<div onload="CutPic(‘<xsl:valueof name='$picPath'/>’)">
上面$picPath形式是变量名,不是原来的节点picPath如果像你这种方法,应该是<div onload="CutPic(‘<xsl:valueof name='picPath'/>’)">但在XSL中会提示少‘>’,所以才声明变量
<div onload="CutPic($picPath)">
<xsl:attribute name="onload">
<xsl:value-of select="concat('CutPic(',$picPath,')')"
</xsl:attribute>
</div>
这个也不行,onload="CutPic($picPath)"和
<xsl:attribute name="onload">
<xsl:value-of select="concat('CutPic(',$picPath,')')"
</xsl:attribute>
有区别么?
<div id="pic" value="/templets/images/test.jpg|/templets/images/ad_1.gif|/templets/images/ad_2.jpg|
">然后在JS中获取
var picPath = document.getElementById("pic").value;