1

如果我从下拉菜单中选择任何内容,则不会调用 javascript 函数 showLeague 并引发错误:Uncaught ReferenceError: showLeague is not defined

<?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 函数在 head 标签中定义,没有 xsl 它可以正常工作。任何帮助,将不胜感激。如果你想观察 html 输出,这里是 url:http ://tipslator.com/Table/deneme/

4

1 回答 1

1

文档http://tipslator.com/Table/deneme/包含一个 iframe http://tipslator.com/xsl/getleaguename.php和一个似乎是 XSLT 结果的 HTML 文档。该 iframe 文档根本没有定义任何脚本函数,因此对函数的任何调用都会出错,除非您确保在 iframe 中定义了这些函数(或者您调用了parent.functionName在父窗口中定义的函数)。

于 2013-08-18T17:53:10.440 回答