Sun Dial Menu
Menu Javascript Functions
 

JavaScript Functions

The more advanced code that I have been looking at requires a better understanding of JavaScript functions, how they are used to create prototype objects and how these objects are used within the Document Object Model of a webpage. Many of the techniques to enable Accessibilty and more complex page behaviours, such as expandable accordians and other interactive screen devices (modals) are achieved this way.

The Propagation of events and parameter useCapture in the anonymous function.

There are far too many JavaScript functions for me to document and I have no intention of trying! I only look into function as I find them in code that I am using.

The example below calls a JavaScript function when the paragraph with the id="demo" is rendered. It is not easy to see below but the contents of the paragraph is instantiated with the value of 4 times 3.

Function Declarations

W3C say:

" Declared functions are not executed immediately. They are "saved for later use", and will be executed later, when they are invoked (called upon). It is generally the case that frequently called functions will be placed in a seperate .js file and linked to the pages that call those functions. "

A Script object can also be defined in an HTML file using the <script> .... </script> tags.

The example below calls a function (when the page loads) which performs a calculation and returns the result:

This is the code:

<script>
var x = myFunction(4, 3);
document.getElementById("demo").innerHTML = x;

function myFunction(a, b) {
return a * b;
}
</script>

The result is:

A JavaScript Function can also be made "inline"

Anonymous Function

An anonymous function is a function without a name. An anonymous function is often not accessible after its initial creation.

Top

Links

Link to PDF Disabled

If you require a copy please email tempusfugit.me.uk

External Links Disabled.

tempusfugit.me.uk is a non-commercial website. No payment or benefit is gained by the placement of links toother websites.

The External link is disabled to on this page, please visit other pages

Unlike most genealogical research websites tempusfugit.me.uk does not attempt to get you to "sign-up" when you click on one of their links.

This Wikipedia link is disabled.

The link on Wikipedia was to:

External Links Disabled.

tempusfugit.me.uk is a non-commercial website. No payment or benefit is gained by the placement of links to other websites.

The External link is disabled to on this page, please visit other pages

Top

External Links - references

Site design by Tempusfugit Web Design -