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

Develop the segment of javascript, Evaluate the following expression:  I...

Evaluate the following expression:  I.            7+5  II.            "7" + "5"  III.            c.       7 * 5 d.      7/5  IV.            e.       7 % 5 2. Develop

Prepare a marketplace which will be dedicated to handicrafts, We aim to pre...

We aim to prepare a MarketPLace which will be dedicated to handicrafts. The concept is to provide artists the ability to sell their products via a MarketPlace similar to etsy or ar

Need help in the data fetching bus operators south america, Need help in th...

Need help in the Data fetching bus operators South America I want to get data fetched from several homepages of Chilean bus operators. I want a table as a result which includes:

Format text, You can format text into the Document window through setting p...

You can format text into the Document window through setting properties in the Property inspector. First one, choose the text you desire to format, and then apply the modification.

Medical data mining, diffierence between ID3 and naive bayes alogrthim

diffierence between ID3 and naive bayes alogrthim

Need a expert for programming a bandcamp for writers, Need a expert for Pro...

Need a expert for Programming A Bandcamp(.com) for Writers and Zine Lovers I want someone who knows how to program a website like Bandcamp where users can have there own place t

Data types, A value, the data assigned to a variable, may contain any sort ...

A value, the data assigned to a variable, may contain any sort of data. Though, JavaScript considers data to fall into many possible types. Based on the type of data, certain opera

A web application of shopping cart using php, You are required to implement...

You are required to implement a shopping cart web using PHP. The web application should allow the user to view the items in a catalogue, add items to a shopping cart, remove items

Abcdefg, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Development of ecommerce store in cakephp, Development of ecommerce store i...

Development of ecommerce store in cakephp Project Description: We want to get help finishing off a project based in cakephp (because we don't have time). Things that would re

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