XSL在Chrome中不能正确呈现/运行

XSL not rendering/acting properly in Chrome

本文关键字:运行 Chrome 不能 XSL      更新时间:2023-09-26

所以,我正在努力更新10-12年的代码是Chrome兼容,我已经停滞不前了。无论出于何种原因,当我输入一个数字,然后单击"fillPO"按钮时,它不会更新任何内容,而是在应该填充的框中放置一个"null"。这可以在Internet Explorer上正常工作。有一个一般的规则,让这个工作在chrome上?

<xsl:template name="control-row">
    <xsl:if test="$orderApprove='true' and $isSuperUser='false' and $archiveView='false' ">
        <td nowrap="true" colspan="10">
            <input type="button" name="servlet" value="Approve" onClick="return approveOrder();">&nbsp;checked orders</input>
            <xsl:if test="/poursxml/OrderedFields/Field='PO'">
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                Fill PO number across orders:&nbsp;
                <input type="text" name="genericPO" id = "genericPO" size="15" maxlength="30"/>
                &nbsp;
                <input type="button" value=" Fill PO " onclick="fillPO()"/>
            </xsl:if>
        </td>
    </xsl:if>
</xsl:template>

这是javascript中的fillPO()。

function fillPO()
{
    if(!anySelected())
        alert('Please select an order first.');
    else
    {
        dfa = document.getElementsByName('orderNumber');
        len = dfa.length;
        var ix = 0;
        for(ix=0; ix<len; ix++)
        {
            if(dfa[ix].name == 'orderNumber')
            {
                if(dfa[ix].checked == true)
                {
                    el_id = dfa[ix].id;
                    position = el_id.substring(11);
                    document.getElementById('PONumber' + position).innerHTML = '<input size="15" maxlength="30" type="text" name="PONumber" value="' + document.getElementById('genericPO').getAttribute('value') + '"></input>';
                }
            }
        }    
    }
} 

大胆猜测:用document.getElementById('genericPO').value代替document.getElementById('genericPO').getAttribute('value')

但是我们真的需要看到一个示例,允许我们在Chrome中重现这个问题。

因为在你发布的代码片段中没有明显的问题(至少对我来说)。这里有一些调试提示(可能会有一点帮助):

  • 考虑查看生成的html(可能复制并格式化),并将其与IE生成的html进行比较。这可以在chrome debugger的Elements选项卡中完成。
  • 尝试在可能不工作的javascript函数中设置断点
  • 如果这仍然没有帮助。考虑复制可能是服务器端生成的xml。这可以在chrome调试器中的"网络"选项卡内完成。尝试减少xml并离线测试它以找到导致问题的部分。
  • 如果调试剂量没有按预期工作。添加一些console.log("test point");alert()调用javascript。

(. .