Pass an arguments to a function, PHP Web Programming

Assignment Help:

You can pass arguments to a function. These are variables, either strings or numbers, which are utilized inside the function. Certainly the output of the function based on the arguments you give it.

In the following instance we pass two arguments, the number 1 & the string 'house':

example(1,'house');

While these arguments arrive at the function, they are stored up in two variables, a & b. You ought to declare these in the function header, as you can look below.

function example(a,b)

<HTML>

<HEAD>

<TITLE>IGNOU </TITLE>

<SCRIPT Language = "JavaScript">

function example(a, b)

{

var number;

number += a ;

alert('You have chosen: ' + b);

}

</SCRIPT>

</HEAD>

<BODY>

<FORM NAME="selectForm">

<P><B>Click the button below:</B>

<BR>

<P><INPUT TYPE="button" VALUE="Click" onClick="example(1,'house')">

</FORM>

</BODY>

</HTML>

2095_Pass An arguments to a function.png

Figure: Using Functions

This adds one to number and displays "You have decided: house". Certainly, if you call the function like example (5,'palace'), then it adds five to number & displays "You have decided: palace". The output of the function based on the arguments you give it.


Related Discussions:- Pass an arguments to a function

I need ecommerce store product, I need eCommerce Store Product I have ar...

I need eCommerce Store Product I have around 300 products that need specs/ descriptions and possibly images for my ecommerce store. I need these things for every product: 1)

Textarea element in a form, Set the element's dimensions using row & column...

Set the element's dimensions using row & column attributes in the textarea tag so the data entered is easily viewable.  The element of course requires an appropriately descriptive

What are the types of code declaration, Question: (a) What are the fou...

Question: (a) What are the four types of code declaration blocks you can use to write PHP? (b) Distinguish between the include() statement and the require() statement.

Need web engineer for revolutionary digital media startup, Looking for a we...

Looking for a web engineer to join revolutionary digital media startup We are shifting the way the world publishes, promotes and consumes video. Want to aid us? We delivers c

Label, , an HTML 4.0 element supported through MSIE & Netscape 6, describe ...

, an HTML 4.0 element supported through MSIE & Netscape 6, describe a set of text that is linked with a specific form element. For instance, the code below specifies t

We are need of a expert website designer, We are need of a expert Website d...

We are need of a expert Website designer I have a client who is currently looking to redesign their law office website. They already have a website however currently looking to

Need help in implementation of new design, Need help in Implementation of N...

Need help in Implementation of New Design I am seeking to have a new design implemented on MeditationMusic.net How long do you think it will take you to implement the designs

Php database hlelp, I am working in php basic learner want to know how to c...

I am working in php basic learner want to know how to connect database

Need help oscommerce postage fee need to paypal fix, Oscommerce postage fee...

Oscommerce postage fee - paypal fix 1. For certain reason the total payable send to ebay seems to no longer comprise the postage fee that was selected at check out. It is expose

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd