SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Apr 2010
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is possible to have onClick to call two functions?

    Hi i have this jwplayer funtion which loads a video into the player the line is bellow basicaly when the user click the image loads those video files into the player
    Code:
    <a href="#" onClick="jwplayer().load({\'file\': \'videosdemo/hofmorpeth.mp4\', \'hd.file\': \'videosdemo/hofmorpethhd.mp4\'})">
    but now i also wanted to have that same onClick to do something else in this case to call another function either ajax function (function loadXMLDoc)
    which just writes data onto a div description of the image.

    you can see the ajax effect here
    Tryit Editor v1.4

    so basically i want to call both functions with just one onclick is it possible??

  2. #2
    SitePoint Addict
    Join Date
    Apr 2010
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now i know its possible to call two functions by creating one function that call two other functions but now because this jwplayer line is
    [CODE][onClick="jwplayer().load({\'file\': \'videosdemo/hofmorpeth.mp4\', \'hd.file\': \'videosdemo/hofmorpethhd.mp4\'})">/CODE]
    i really dnt know how to do

    this one way i've used make one function call 2 other function but how can i implement something similar on my code above

    Code:
    <head>
    <script type="text/javascript">
    
    function displaymessage()
    {
    funcOne();
    funcTwo()
    }
    
    
    function funcOne() {
      document.write("function 1 <br />");
    }
    
     function funcTwo() {
      document.write("function 2");
    }
    
    </script>
    </head>
    
    <body>
    <form>
    <input type="button" value="Click me!" onclick="displaymessage()" />
    </form>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •