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

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

Interactive music playing website uising html and javascript, Interactive m...

Interactive music playing website uising HTML and Javascript Fundamentally we're looking to recreate (and previously turntable.fm), nevertheless using a third party music servic

Need help in dashboard application development, Dashboard application We...

Dashboard application We're seeking to create a dashboard tracking application from various feeds job requires bit of research as well as knowledge of API's plus of course super

Executing deferred scripts, Deferred scripts do not immediately do anything...

Deferred scripts do not immediately do anything. To use deferred commands, you have to call them from outside the deferred script. There are three methods to call deferred scripts

I need a help in css responsive site, I need a help in CSS responsive site ...

I need a help in CSS responsive site CSS responsive to convert site in to responsive Job Description- I have some web sites which want attention and I would like to work o

I need help to convert a non responsive wordpress theme, I need help to Con...

I need help to Convert a non responsive wordpress theme to responsive Twitter Bootstrap3 My website is using a none responsive wordpress theme. I want to translate this theme in

Php app in bootstrap with user mgmt, Php app in bootstrap with user mgmt, f...

Php app in bootstrap with user mgmt, form, csv import/export and stats Project Description: Overview: Need an application construct in PHP to allow agents to log in, view

Javascript with html, Events are actions which can be detected through Java...

Events are actions which can be detected through JavaScript.  An example would be the on Mouse Over event that is detected while the user moves the mouse on an object.  Another eve

Describe how syntax errors occur in php, Question: (a) Describe how syn...

Question: (a) Describe how syntax errors occur in PHP. Illustrate your answer with extract codes. (b) Explain two methods that might be used to control sessions in a web ba

We require a drupal developer, We require a Drupal developer I'm in sear...

We require a Drupal developer I'm in search of a skilled and experienced Drupal developer who can work with me on the following- a) Fix theme issues mainly related to CSS (Th

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