document.ready vs window.load

document.ready is fired once the html has loaded while windows.load is fired once everything has loaded including images, jquery, html, text from db etc.

Therefore the document.ready would fire before the window.load

examples:

<script>

$(document).ready(function() {

//your code here – fired when html loads

});

$(window).load(function() {

//your code here – fired when all page elemenets are loaded

});

</script>

 

Quick JavaScript Confirm Message Validator

For a quick and simple confirm message validator fire an OnClientClick event on the element required to validate. For instance on a delete link paste the following javascript call:

OnClientClick=”javascript:return confirm(‘Are you sure you want to Delete?’);”

This will display a pop up message giving yes or no as an option. If no is clicked, the click event is ignored, if yes is clicked, the click event is accepted.

Step by Step CSS3 Animation for beginners

css3animation

CSS3 has been introducted recently with the aim to phase out flash. Older browsers do not support CSS3 so make sure to have the latest version of whatever browser you prefer using. I will be using Chrome for this tutorial so we will need the google webkit. Even if you will not use Chrome, it is still suggested that you keep the webkit to make sure that users visiting your site with Chrome can view the CSS3 animation properly.

The most basic and important rule we need to know is called the @keyframes where we specify the animation we would like to have from beginning to end.

When using the @keyframes we can specify at what time we want the animation to take place. We can use from{} and to {} or percentage values such as 0%{}, 50%{}, 100%{} etc.

Lets create some simple examples….  Continue reading

XML – Domains, protocols and ports do not match

Error:

I was trying to load an xml stylesheet called xsl and I kept getting the following errors:

on Chrome: Unsafe attempt to load URL chrome-extension: .xsl from frame with URL test.xml. Domains, protocols and ports must match.

on Firefox: Error loading stylesheet: An unknown error has occurred (805303f4)

Cause:

Each browser has some security policies which do not allow access to different domains, protocols or ports are seen above.

Solution:

Allow access using cross domain policy. There are two ways of doing so:

Continue reading