XML:
<CONTROLS>
<BUTTON>
<input name="myButton" onclick="existingFunction();"/>
</BUTTON>
<LABEL>
Text ME
</LABEL>
</CONTROLS>
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="input">
<input onclick="{@onclick}newFunction();">
<xsl:copy-of select="@*[not(name()='onclick')]"/>
</input>
</xsl:template>
</xsl:stylesheet>
如何将两个函数放入一个 onclick 属性中?
结果:
<input onclick="existingFunction();newFunction();" name="myButton"/>
它不工作。还有其他方法可以合并这两个功能吗?
我不想将函数 2 放入函数 1 中。:)
最佳答案
替代答案:
在 onClick 事件上调用 function3() ..看起来像
function function3()
{
function1();
function2();
}
关于javascript - 如何将两个函数放入一个 onclick 属性中? XSLT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13835505/