944,082 Members | Top Members by Rank

Ad:
Jun 1st, 2007
0

javascript function

Expand Post »
Hi ,can anyone tell me if we pass a function to another function as a parameter in javascript?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
annomalis is offline Offline
1 posts
since Jun 2007
Jun 3rd, 2007
0

Re: javascript function

Yes.

javascript Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script>
  4. function add(a, b)
  5. {
  6. alert(a + b);
  7. }
  8.  
  9. function takingFunction(x, y, func)
  10. {
  11. func(x, y);
  12. }
  13. </script>
  14. <head>
  15. <body>
  16. <form>
  17. <input type="submit" value="Submit" onclick="javascript:takingFunction(2, 3, add)" />
  18. </form>
  19. </body>
  20. </html>
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Hmm... Javascript error, or Mozilla stupidity?
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Please help me to Print Layer content from Java Script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC