• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

JavaScript Onload ...

 JavaScript was initially designed for the web and is made even better for the web whenever it is updated, so it is quite easy to see why people are impressed with the JavaScript language.  There are a number of things that you can do in order to make your website better with the JavaScript functions and therefore it is important for people to realize exactly what those functions happen to be.

For starters, one of those functions is known as the onload function.  This is one of the earliest taught functions for JavaScript because of not only the ease of learning that it brings to the table, but also because it is one of the more basic functions around.  Onloads will be big parts of larger chunks of JavaScript code and this is why it is important that people learn about them early on within their JavaScript training.

Now, like most pieces of code in JavaScript, it serves no purpose to verbally explain what the onload function does without using an example in order to help that illustration along.  To that end, take a look at the following piece of code:

<html>
<head>
<script type=”text/javascript”>
Function message()
{
Alert(“Hello World”)
}
</script>
</head>

<body onload=”message()”>

</body>
</html>

Have you ever seen a prompt window pop up when you get to a website with a message for you to read and then at least one option button (i.e. the okay button, although sometimes there is more than one option depending on what the message says) for you to click?  Well, if you stuck this little bit of code into your website, anyone that visited it would have a pop-up message that said “Hello World.”

This is done through the use of the message() function, but that is not the part of the code we are predominantly interested in.  We are interested in the onload attribute of the body tag, which happens to execute the function that was defined within the head part of the HTML code.  Attaching the onload attribute to the body tag ensures that the message() function is executed as soon as the site is displayed.  Message() is not the only function that can be onloaded and therefore you can see easily now why the onload attribute is an important one to learn.
source: wowdev

 Original Source:

AddThis Social Bookmark Button

Posted at 09:52:20 am | Permalink | Posted in Javascript  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Top Stuff

MessengerFX

e-messenger

ILoveIM

Top 20 Ruby CMS

eBuddy

MSN Web Messenger



About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Search


Topics

  • .Net (164)
  • Ajax (82)
  • Ajax Games (10)
  • Articles (95)
  • Bookmarking (35)
  • Calendar (20)
  • Chat (45)
  • ColdFusion (3)
  • CSS (75)
  • Email (23)
  • Facebook (83)
  • Flash (19)
  • Google (54)
  • Html (27)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (54)
  • Javascript (265)
  • jQuery (159)
  • JSON (61)
  • Perl (2)
  • PHP (156)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (8)
  • Ruby (31)
  • Storage (4)
  • Toolkits (103)
  • Tutorials (217)
  • UI (11)
  • Utilities (174)
  • Web2.0 (18)
  • XmlHttpRequest (28)
  • YUI (12)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange