0% found this document useful (0 votes)
26 views

Javascript

A function contains code that will be executed by an event or call to the function. Functions can be defined in the <head> or <body> sections of an HTML document but placing them in the <head> ensures the function is loaded before it is called. Functions allow code to be executed from within a page or other pages by embedding the function in an external JavaScript file.

Uploaded by

Zayaan Rnb
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Javascript

A function contains code that will be executed by an event or call to the function. Functions can be defined in the <head> or <body> sections of an HTML document but placing them in the <head> ensures the function is loaded before it is called. Functions allow code to be executed from within a page or other pages by embedding the function in an external JavaScript file.

Uploaded by

Zayaan Rnb
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

JavaScript Functions

Previous Next Chapter


A function will be executed by an event or by a call to the function.

JavaScript Functions

To keep the browser from executing a script when the page loads, you can put your script into a function. A function contains code that will be executed by an event or by a call to the function. You may call a function from anywhere within a page (or even from other pages if the function is embedded in an external .js file). Functions can be defined both in the <head> and in the <body> section of a document. However, to assure that a function is read/loaded by the browser before it is called, it could be wise to put functions in the <head> section.

You might also like