Javascript Page Loading Effect

A simple javascript page load effect

This example shows you how you can create a page loading effect that runs until the complete page loads and exit automatically when page loads completely. The code is simple and self explanatory. Copy the below code and paste in notepad and save it with .html extension and run.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Loading</title>
<style type="text/css">
#load
{
    background:url(opacity.png);
    width:100%;
    height:2000px;
    z-index:11;
    position:absolute;
    top:0px;
    left:0px;
    text-align:center;
}
</style>
<script type="text/javascript" language="javascript">
function loading()
{
    document.getElementById("load").style.display = 'none';   
}
window.onload = loading;
</script>
</head>

<body>
<div id="load">   
        <img style="margin-top:200px;" src="loading_big.gif" alt="loading" />
        <br /><br />
        <h1 style="color:#8B7637;">Loading Please Wait..</h1>               
    </div>

        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
        <img src="apple.jpg" alt="apple" />
</body>
</html>
 Screenshot

 

Download the complete code from here:-
http://cid-fd367ee904a1f99a.office.live.com/self.aspx/Javascript/load.rar 

Comments

Post a Comment

Popular posts from this blog

Get Query String Values With Javascript

Change Css Class of li in ul onclick

Change Text Color with Javascript