简体   繁体   English

未定义XSL OnChange Javascript函数

[英]XSL OnChange Javascript Function not Defined

If I select anything from dropdown menu, javascript function showLeague is not called and throws an error: Uncaught ReferenceError: showLeague is not defined 如果从下拉菜单中选择任何内容,则不会调用javascript函数showLeague并引发错误:Uncaught ReferenceError:showLeague未定义

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
    method="html"
    omit-xml-declaration="yes"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    indent="yes"></xsl:output>
<xsl:param name="tsid" /> 


<xsl:template match="spocosy">      

    <form>
    Select a League:

    <select>
    <xsl:attribute name="name">
        <xsl:value-of select="cds"/>
    </xsl:attribute>

    <xsl:attribute name="onchange">
        showLeague(this.value)
    </xsl:attribute>


    <option value="">Leagues:</option>
    <xsl:for-each select="standing">
    <option>
    <xsl:attribute name="value">
        <xsl:value-of select="@id"/>
    </xsl:attribute>
    <xsl:value-of select="@league"/>
    </option>
    </xsl:for-each>  
    </select>
    </form>

    <div id="txtHint"><b>League info will be listed here...</b></div>
</xsl:template>

showLeague function is defined in the head tag and without xsl it is working without any problem. showLeague函数在head标记中定义,没有xsl,它就可以正常工作。 Any help would be appreciated. 任何帮助,将不胜感激。 If you want to observe html output here is the url: http://tipslator.com/Table/deneme/ 如果您想观察html输出,请访问以下网址: http : //tipslator.com/Table/deneme/

The document http://tipslator.com/Table/deneme/ contains an iframe http://tipslator.com/xsl/getleaguename.php with a HTML document which seems to be the XSLT result. 文档http://tipslator.com/Table/deneme/包含一个iframe http://tipslator.com/xsl/getleaguename.php和一个HTML文档,这似乎是XSLT结果。 That iframe document does not define any script function at all so any call to a function will give an error, unless you make sure the functions are defined in the iframe (or you call up parent.functionName to call functions define in the parent window). 该iframe文档根本没有定义任何脚本函数,因此,除非确保在iframe中定义了这些函数,否则对函数的任何调用都会产生错误(或者您调用parent.functionName来调用在父窗口中定义的函数) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM