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

Create a web page that allow students to use external files, The purpose of...

The purpose of this exericse is to allow students to practice using external files in support of web applications. For this exercise, imagine that the Batty League Flea Market acce

I need help to make hotel booking site, I need help to make Hotel Booking S...

I need help to make Hotel Booking Site - GDS Integration We are building a hotel booking site through GDS integration. We wish to grow very quickly to test concept as well as op

Oop, how to know object oriented in php

how to know object oriented in php

Personal portfolio site, This site must include at least 5 pages - your Hom...

This site must include at least 5 pages - your Home page, an About Me page, a Projects page, a Services page, and a Contact Me page. 1.  Your Home page should include the followi

We are in need of help in turnkey site development, We are in need of help ...

We are in need of help in TurnKey Site Development Our company had a web site skilfully created in PSD. We want a developer to turn the site from PSD files to HTML/CSS/JavaScrip

Web browser, A Web browser is software program which allows you to easily d...

A Web browser is software program which allows you to easily display Web pages & navigate the Web. The first graphical browser namely Mosaic, was developed in Illinois at the Natio

Use of meta tag, In this unit we have learnt how to create simple HTML page...

In this unit we have learnt how to create simple HTML pages. The contents of the page have to be written within the BODY tag. The HEAD tag includes the title of the document. An im

Web site in psd besides need it coded in html 5, HTML5 Web Site We have ...

HTML5 Web Site We have a web site in PSD besides need it coded in HTML 5 and CSS3 and put on our domain. 8 pages - 2 lightboxes - 3 forms We have a PSD required to be code

Develop a bilingual website that will have an online store, Develop a bilin...

Develop a bilingual website that will have an online store and information about the designer of the product. Our product is glass blown merchandise and art. Job description:

Need help in wordpress website migration and move, Wordpress website migrat...

Wordpress website migration / move We have a word press site that is not working with the duplicator plugin. We just want it shifting across to some new hosting. Must just

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