iCeR
iCeR

Reputation: 149

how can i put two function in one onclick attribute? XSLT

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>

how can i put two functions in one onclick attribute?

result:

<input onclick="existingFunction();newFunction();" name="myButton"/>

its not working. is there any other way to merge this two functions??

i dont want to put the function 2 inside the function 1. :)

Upvotes: 1

Views: 1496

Answers (2)

Rookie Programmer Aravind
Rookie Programmer Aravind

Reputation: 12154

alternative answer:

call function3() on onClick event .. which looks like

function function3()
{
  function1();
  function2();
}

Upvotes: 1

Joel Peltonen
Joel Peltonen

Reputation: 13402

Would something like this work for you?

onclick="function baz(){foo(); bar();} baz();"
// or
onclick="(foo(); bar(); baz(); derp(); ... )()";

Upvotes: 0

Related Questions