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

Onload Javascript Example ...

In this tutorial you can show afew javascript examples

Image swapping:

Here is the classic mouseover button effect that shows one image when it is left alone, and another when the mouse passes over it, there are two graphic buttons, one called "img11.jpg" and the other called "img21.jpg." The buttons contain onMouseOver and onMouseOut instructions that change the image objects from "img11.jpg" to "img12.jpg" and from "img21.jpg" to "img22.jpg" respectively, and back again.

<html>
<head>
</head>
<script type="text/javascript">
<!--
function PreloadImages() {
  var aImages = new Array(img12.jpg,img22.jpg);
  for(var i=0; i < aImages.length; i++) {
    var img = new Image();
    img.src = aImages[i];
  }
}
//-->
</script>
<body onLoad="PreloadImages()">

<a href="index.html"
onMouseOver="document.img1.src=img12.jpg;"
onMouseOut="document.img1.src=img11.jpg;">
<img src="img11.jpg" name="img1">

<a href="javascript-examples.html"
onMouseOver="document.img2.src=img22.jpg;"
onMouseOut="document.img2.src=img21.jpg;">
<img src="img21.jpg" name="img2">

</body>
</html>

Using cookies:

This script uses a cookie to store the variable count.

<html>
<body>

<script type="text/javascript">
<!--
var count=document.cookie.indexOf("cnt=");
if(count>=0) count=document.cookie.substring(count+4);
else count=0;
document.cookie = "cnt=" + (count+1) + ";expires=Fri,1 Jan 2010 00:00:00";
var aStrings = new Array(
  "<a href=index.html>Home Page</a>",
  "<a href=examples.html>JavaScript Examples</a>",
  "<a href= utorials.html>JavaScript Tutorials</a>"
);
document.write(aStrings[count%aStrings.length]);
//-->
</script>

</body>
</html>

 Original Source:

AddThis Social Bookmark Button

Posted at 02:20:47 pm | 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

MSN Web Messenger

eBuddy



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 (171)
  • Ajax (89)
  • Ajax Games (10)
  • Articles (95)
  • Bookmarking (35)
  • Calendar (21)
  • Chat (45)
  • ColdFusion (3)
  • CSS (79)
  • Email (23)
  • Facebook (84)
  • Flash (19)
  • Google (54)
  • Html (28)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (56)
  • Javascript (271)
  • jQuery (171)
  • JSON (70)
  • Perl (2)
  • PHP (162)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (8)
  • Ruby (31)
  • Storage (4)
  • Toolkits (103)
  • Tutorials (224)
  • UI (11)
  • Utilities (174)
  • Web2.0 (18)
  • XmlHttpRequest (28)
  • YUI (13)

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