逻辑:在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()中请大虾们帮帮忙,在线等!

解决方案 »

  1.   

    <div onload="CutPic($picPath)">这有问题=》<div onload="CutPic(<xsl:valueof name='$picPath'/>)">具体看一下帮助,有段时间不用xsl,如果还不行,就如下
    <div onload="CutPic(‘<xsl:valueof name='$picPath'/>’)">
      

  2.   


    上面$picPath形式是变量名,不是原来的节点picPath如果像你这种方法,应该是<div onload="CutPic(‘<xsl:valueof name='picPath'/>’)">但在XSL中会提示少‘>’,所以才声明变量
      

  3.   


    <div onload="CutPic($picPath)">
       <xsl:attribute name="onload">
            <xsl:value-of select="concat('CutPic(',$picPath,')')"   
       </xsl:attribute>
    </div>
      

  4.   


    这个也不行,onload="CutPic($picPath)"和
    <xsl:attribute name="onload">
      <xsl:value-of select="concat('CutPic(',$picPath,')')"   
    </xsl:attribute>
    有区别么?
      

  5.   

    直接传进去!
    <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;