Creating PopUP Window On Blogger

As you might knew, Pop-up window is a page that shows next or behind (or, in front or background) the major page automatically with or without a click made. It could be one, two, or more pages just as what it's been specified by the maker. Generally, it's used to show ads or even something in connection to offers, or something like that. - Just, maybe you should think twice to implement this methode on your site since it could affect your site load, though the script used maybe realy short, cuz it's not because of the script, but page pop-ups on the new window. And beside, it will likely also annoy your visitors for they have to reload the page they're visiting as clicking on the pop-up window to get rid of it. So, think twice to add a popup window on your site..

How To Create It?

Simply easy, there are three styles that you can use here, popup window opens by a click, popup window opens as the visitor load your site, popup window opens only to the first visit, or popup window opens in a specific time as you set the range. And here, we'll use the scripts from www.javascriptkit.com

1. Login to your Blogger.
2. Go to Design.
3. Edit Html.
4. Find the tag <body> in your template and put one of the codes below beneath it.

Popup Window Opens By A Click

The code above looks like the below.

<script type="text/javascript">

//JK Popup Window Script (version 3.0)- By JavaScript Kit (http://www.javascriptkit.com)
//Visit JavaScriptKit.com for free JavaScripts
//This notice must stay intact for legal use

function openpopup(popurl){ var winpops=window.open(popurl,"","width=,height=,location,status,scrollbars,resizable")
}
</script>


Now, put the following code anywhere you want the popup button to show up.

The code above looks like the below.

<a href="javascript:openpopup('http://www.google.com')">Click to open the popup window</a>


Just change the http://www.google.com with any url whose page you want to popup.

Popup Window Opens Only One Time

The code above looks like the below.

<script type="text/javascript">

//JK Popup Window Script (version 3.0)- By JavaScript Kit (http://www.javascriptkit.com)
//Visit JavaScriptKit.com for free JavaScripts
//This notice must stay intact for legal use
//Win Type: Pop Up | Session Only
//Specify URLs to randomly select from and popup/popunder:
//To display a single URL, just remove all but the first entry below:
var popurls=new Array()
popurls[0]="http://j-smith-site.blogspot.com"
popurls[1]="http://j-smith-site.blogspot.com/2012/06/creating-table-using-html-code.html"
popurls[2]="http://j-smith-site.blogspot.com/2012/06/ps1-games-collection-for-nokia-s60v5-v3.html"
popurls[3]="http://j-smith-site.blogspot.com/2012/06/updates-of-browser-handler-opera-mini.html"

function openpopup(popurl){ var winpops=window.open(popurl,"","width=,height=,location,status,scrollbars,resizable")
}

function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;

returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadornot(){ if (get_cookie('jkpopup')==''){ openpopup(popurls[Math.floor(Math.random()*(popurls.length))]) document.cookie="jkpopup=yes"
}
}

loadornot()
</script>


Popup Window Opens Anytime

The code above looks like the below.

<script type="text/javascript">

//JK Popup Window Script (version 3.0)- By JavaScript Kit (http://www.javascriptkit.com)
//Visit JavaScriptKit.com for free JavaScripts
//This notice must stay intact for legal use
//Win Type: Pop Up | Always

//Specify URLs to randomly select from and popup/popunder:
//To display a single URL, just remove all but the first entry below:
var popurls=new Array()
popurls[0]="http://j-smith-site.blogspot.com"
popurls[1]="http://j-smith-site.blogspot.com/2012/06/creating-table-using-html-code.html"
popurls[2]="http://j-smith-site.blogspot.com/2012/06/ps1-games-collection-for-nokia-s60v5-v3.html"
popurls[3]="http://j-smith-site.blogspot.com/2012/06/updates-of-browser-handler-opera-mini.html"

function openpopup(popurl){ var winpops=window.open(popurl,"","width=,height=,location,status,scrollbars,resizable")
}

openpopup(popurls[Math.floor(Math.random()*(popurls.length))])

</script>


Popup Window Opens Regularly

The code above looks like the below.

<script type="text/javascript">

//JK Popup Window Script (version 3.0)- By JavaScript Kit (http://www.javascriptkit.com)
//Visit JavaScriptKit.com for free JavaScripts
//This notice must stay intact for legal use
//Win Type: Pop Up | 5 minutes period

//Specify URLs to randomly select from and popup/popunder:
//To display a single URL, just remove all but the first entry below:
var popurls=new Array()
popurls[0]="http://j-smith-site.blogspot.com"
popurls[1]="http://j-smith-site.blogspot.com/2012/06/creating-table-using-html-code.html"
popurls[2]="http://j-smith-site.blogspot.com/2012/06/ps1-games-collection-for-nokia-s60v5-v3.html"
popurls[3]="http://j-smith-site.blogspot.com/2012/06/updates-of-browser-handler-opera-mini.html"

function openpopup(popurl){ var winpops=window.open(popurl,"","width=,height=,location,status,scrollbars,resizable")
}

function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search) if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;

returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

popfrequency="5 minutes"

function resetcookie(){ var expireDate = new Date() expireDate.setMinutes(expireDate.getMinutes()-10)
document.cookie = "jkpopunder=;path=/;expires=" + expireDate.toGMTString()
}

function loadornot(){ if (get_cookie('jkpopunder')==''){ openpopup(popurls[Math.floor(Math.random()*(popurls.length))])
var expireDate = new Date() expireDate.setMinutes(expireDate.getMinutes()+parseInt(popfrequency))
document.cookie = "jkpopunder="+parseInt(popfrequency)+";path=/;expires=" + expireDate.toGMTString()
}
}

if (get_cookie('jkpopunder')!=parseInt(popfrequency))
resetcookie()
loadornot()

</script>


That's all.

0 comments:

Post a Comment