Search | View Active Threads | View New Posts
Current Time: 06:46 PM

 

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2016
    Location
    Delhi
    Posts
    38

    Thumbs up How to Call a Function

    The calculateArea() function does nothing sitting on its own in the head of a document; it has to be called. In this example, you can call the function from a simple form using the onclick event, so that when the user clicks the Submit button the area will be calculated.

    Code:
    <form name=”frmArea” action=””>
    Enter the width and height of your rectangle to calculate the size:<br />
    Width: <input type=”text” name=”txtWidth” size=”5” /><br />
    Height: <input type=”text” name=”txtHeight” size=”5” /><br />
    <input type=”button” value=”Calculate area”
    onclick=”alert(calculateArea(document.frmArea.txtWidth.value,
    document.frmArea.txtHeight.value))” />
    </form>

    Take a closer look at what is happening when the onclick event fires. First a JavaScript alert is being called, and then the calculateArea() function is being called inside the alert, so that the area is the value that is written to the alert box. Inside the parentheses where the calculateArea() function is being called, the two parameters being passed are the values of the width text box and the height text box using the dot notation you learned early in the section on the DOM.

  2. #2
    Join Date
    May 2019
    Location
    Bangalore
    Posts
    107
    #include<stdio.h>
    // function prototype, also called function declaration.
    void swap(int a, int b);
    int main()
    {
    int m = 22, n = 44;
    // calling swap function by value.
    printf(" values before swap m = %d \nand n = %d", m, n);

  3. #3
    Join Date
    Sep 2018
    Posts
    115
    Use the keyword function followed by the name of the function. After the function name, open and close parentheses. Within curly braces, write your lines of code.


    Top Astrology Services in Canada | Indian Astrologer in Toronto | Best Indian Astrologer in Toronto | Indian Astrologer in Canada | Best Indian Astrologer in Canada | Astrologer in Canada

Posting Permissions

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

Sponsors

Above.com Domain Registrar, Marketplace and Revenue Optimizer
Trellian Direct Search Network
Domain Escrow Services

Industry Events

11-14 August 2019
Affiliate Summit East
New York, NY

4-6 March 2019
LeadsCon
Las Vegas

15-18 September 2018
MERGE 2018
Orlando, FL

Poll

How do you invest in domains?
to see the Poll results!
DomainState.com
Domain Tools | Domain Directory | Registrar Stats | Domain Glossary | Industry Events | FAQ | Members | Terms | RSS | Link To Us | Advertise | Contact Us
Other Related Trellian Services:
Above.com Registrar  |  Above.com Marketplace  |  Above.com Domain Manager  |  Free Search Toolbar  |  Free Webpage Builder  |  Keyword Research
Direct Search Navigation  |  Search Engine Submission and SEO Tools
Copyright © 2002 DomainState.com a Trellian Company 2014 Bronze Sponsor - Internet Commerce Association