RSS

Monthly Archives: August 2010

Displaying loading image untill a page has fully loaded using Javascript

By implementing the following code, you can display the spinning image until the page has fully loaded.

You need to do two things:
1. In header section, you need to implement following  javascript code.

<script>

var body = document.getElementsByTagName(‘BODY’)[0];

if (body && body.readyState == ‘loaded’) {

AfterLoad();

} else {

if (window.addEventListener) {

window.addEventListener(‘load’, AfterLoad, false);

} else {

window.attachEvent(‘onload’, AfterLoad);

}

}

function AfterLoad() {

image.style.display=’none’;

}

</script>

2. After the <body> tag you need to show the loading image. (like, image.style.display=’ ‘;)

That is it.

HAPPY PROGRAMMING!

 
Leave a comment

Posted by on August 28, 2010 in Javascript

 

Tags: , ,

Checking popup block in Google Chrome using javascript

Following is a JavaScript using which you can identify the popup block in case of Google Chrome.

<script type=”text/JavaScript” language=”JavaScript”>

var mine = window.open(‘popuptest.htm’,’popuptest’,’width=1px,height=1px,left=0,top=0,scrollbars=no’);
if(!mine|| mine.closed || typeof mine.closed==’undefined’)
{
popUpsBlocked = true
alert(‘Popup blocker detected ‘);

}
else
{
popUpsBlocked = false

}

</script>

Enjoy!!!!!!!.

 
Leave a comment

Posted by on August 19, 2010 in Uncategorized

 

Tags: , ,