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 want a simple wordpress blog, Wordpress blog I want a simple Wordpress...

Wordpress blog I want a simple Wordpress blog with the ability to upload articles in addition pics by myself. It want to be something like that - beside the articles I need sect

Xenforo add-on required, Project Description: I am seeking an add-on to ...

Project Description: I am seeking an add-on to be coded for the Xenforo forum software. The add-on would be a post pruning system that will be customized on a per-forum level. I

Need help to add ubercart and configure for drupal 6 website, Need help to ...

Need help to Add Ubercart and Configure for Drupal 6 Website This project will be to install Ubercart on a Drupal 6 website and configure it to add the following- 1) product

I want help in api integration, I want help in API Integration The ecomm...

I want help in API Integration The ecommerce platform we use has an API as layed out and we have some third paries we would like to incorporate starting with invitebox.com. More

I want help in wordpress site needs addons and configuration, I want help i...

I want help in Wordpress site needs addons and configuration For months I have been attempting to have my ecommerce site built to my needs, however keep running into snags with

Determine the date and time, Use the PHP date function described in IT 202 ...

Use the PHP date function described in IT 202 manual (p. 200), or in w3schools or online PHP manual. Invoke the PHP date function in the script and output to browser. Use a forma

Needed a programmer experienced in wp theme, Programmer Experienced in WP T...

Programmer Experienced in WP Theme I have installed theme with bluehost. I have created the front page. Purchased Form Maker. My website has the front page designed. I want h

Session management, I need help with adding session management to my login ...

I need help with adding session management to my login webpage. It is the MVC method and has 2 models and 1 view alongside the login page of course. I just need assistance with the

Move the layout table, You can choose and move a layout table to other area...

You can choose and move a layout table to other areas in a document. However, you cannot move a layout table so that it overlaps another. After that you will move the table you

I want to develop a discussion board and classifieds, I want to develop a D...

I want to develop a Discussion Board/Classifieds I'm seeking to create a discussion board/classifieds for the community I live in I do like to know what platform you'd use an

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