2013-08-18 58 views
1

如果我選擇從下拉菜單中,JavaScript函數showLeague不叫,並拋出一個錯誤東西:未捕獲的ReferenceError:showLeague沒有定義XSL的OnChange JavaScript函數沒有定義

<?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輸出,請訪問以下網址:http://tipslator.com/Table/deneme/

+0

考慮發佈一個最小但完整的樣本,讓我們能夠重現問題。 –

+0

我應該發佈有關此問題的完整代碼嗎? – mctuna

+0

嘗試將問題隔離到最小但完整的示例,然後發佈。或者發佈一個我們可以訪問該問題的網址。 –

回答

1

文檔http://tipslator.com/Table/deneme/包含一個iframe http://tipslator.com/xsl/getleaguename.php,其中包含一個HTML文檔,該文檔似乎是XSLT結果。該iframe文檔根本沒有定義任何腳本函數,因此除非您確定函數是在iframe中定義的(或者調用parent.functionName來調用在父窗口中定義的函數),否則對函數的任何調用都會給出錯誤。