逻辑:在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.   


    <input id="picUrl" type="hidden">
                <xsl:attribute name="value">
                    <xsl:value-of select="$picPath"/>            
                </xsl:attribute>
           </input>
    把值保存到隐藏域,用户的时候再获取
      

  2.   

    可能我说的不大清楚,我在JS外调用函数:页面加载onload="CutPic('/templets/images/test.jpg|/templets/images/ad_1.gif|')"然后把值传给JS中的函数,给数组arrUrl赋值,随后可以在函数外使用数组arrUrl的值如果使用返回值,在函数外调用该函数CutPic(参数),里面参数怎么搞?参数是未知的
      

  3.   

    <div onload="CutPic( "+<xsl:value-of select="$picPath"/> +")">这样不行的话,就把值 放入一个隐藏域里面。在js 函数里面取这个隐藏域的值。
      

  4.   

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