简体   繁体   English

IE11中的onclick函数不起作用

[英]onclick function in IE11 not working

I've this template for function call to show some detail. 我有用于函数调用的模板,以显示一些细节。 It is working in IE9 but not in IE11. 它可以在IE9中工作,但不能在IE11中工作。 How to make it compatible for IE11? 如何使其与IE11兼容? The event is not getting called. 该事件未得到调用。

 <xsl:template name="DrillLink">
            <xsl:param name="ObjectName" select="''"/>
            <xsl:param name="ObjectID" select="''"/>
            <xsl:choose>
                <xsl:when test="(@ObjectType = 'BO' or @ObjectType = 'SO') and @DetailEnabled = '1' and @HideDetail = '0' ">
                    <span href="javascript:;"  onMouseOver="window.status='Drill down {@ObjectName}'; return true;" value ="'0'" onMouseOut="window.status=''; return true;"
                        onClick="showDetail(this); return false;" box_name="expand" id="ShowDetail" style="margin-right:5;" detailIndent="1"
                        title="{@ObjectDetailText}"
                        OrderKey="{@OrderKey}"
                        StartDate="{@Date}" EndDate="{@Date}"
                        ObjectID = "{@ChildObjList}"
                        Duration    = "{@Date}"
                        TimeZoneID = "{@TimeZoneID}"
                        TransformUpID = "{@TransformUp}"
                        TransformDownID = "{@TransformDown}"
                        RoundTypeID = "{@RoundType}"
                        PrecisionID = "{@Precision}"
                        CarryForwardPrecisionID = "{@CarryForwardPrecision}"
                        UserID = "{@UserID}"
                        EnableObjectType = "{@ObjectType}"
                        DisplayBuilderID = "{@DisplayBuilderID}"
                        RealTimeView = "{@RealTimeView}"
                        ForwardHour = "{@ForwardHour}"
                        BackwardHour = "{@BackwardHour}"
                        class = "dmActionBtn"
                    >+</span>
                    <xsl:text>&amp;#160;</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:choose>
                        <xsl:when test="normalize-space(@ObjectID) = 0 ">
                            <xsl:text>&amp;#160;</xsl:text>
                        </xsl:when>
                        <xsl:otherwise>

                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>

There are a few problems: 有几个问题:

Some browsers tolerate the (incorrect) capitalisation, and some do not (which would explain the inconsistencies between them). 有些浏览器可以忍受(不正确的)大写字母,而有些则不能(这可以解释它们之间的不一致)。

Also, note that you should not be using inline event handlers to begin with, and should instead be making use of addEventListener to attach the respective events to the elements: 另外,请注意,您一开始应该使用内联事件处理程序,而应该使用addEventListener将各个事件附加到元素上:

 document.getElementById("button").addEventListener("click", function() { console.log('Clicked'); }); 
 <button id="button">Click</button> 

Hope this helps! 希望这可以帮助! :) :)

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

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