GeekInterview.com
Series: Subject: Topic:
Question: 11 of 29

How do you call function in javascript?

Asked by: parthoaccy | Member Since May-2008 | Asked on: May 5th, 2008

View all questions by parthoaccy

Showing Answers 1 - 4 of 4 Answers

Code
  1. <script language="javascript" type="text/javascript">
  2. //Declare Function
  3. function a() {
  4.  alert("function called");
  5. }
  6. //call function from the script it self
  7. a();
  8. </script>
  9.  
  10. //call function on button click
  11. <input type="button" onclick="a()"/>

  
Login to rate this answer.
IRS786

Answered On : Aug 10th, 2008

View all answers by IRS786

For example:

Code
  1.  
  2. <html>
  3. <head>
  4. <script type="javascript">
  5. function call() {
  6.    alert{"are you calling me!"};
  7. }
  8. </script>
  9. </head>
  10. <body>
  11. <form>
  12.   <input type="button" onclick="call()" value="call">
  13. </form>
  14. </body>
  15. </html>

  
Login to rate this answer.
salijaffar

Answered On : Feb 27th, 2009

View all answers by salijaffar

Just write the name of the function and a pair of small brackets then semi-colon after it.
example.
functionName();

Yes  1 User has rated as useful.
  
Login to rate this answer.
Ranjan Kumar

Answered On : Sep 22nd, 2011

Code
  1.  
  2. function CollFunction()
  3. {
  4. alert("ok")
  5. }
  6.  

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.