We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
[CODE] Pop-Up ONLY once!; *Isn't annoying! ONCE ONLY*; By xlilmissjulieeex
Topic Started: Jan 25 2010, 09:18 AM (41 Views)
Reid
Member Avatar
È una trappola!

This topic has been moved from our official support board.

Originally posted by: xlilmissjulieeex
[CODE
 
Pop-Up ONLY once!; *Isn't annoying! ONCE ONLY*]NOTE: I DID NOT, I repeat, DID NOT make this code.

Well many people have been wanting a code that pops up ONLY once adn so here it is:


Description: Alert a basic message to your visitors when they visit your webpage. And to not irritate them, the script controls the frequency of this alert to only once per browser session.

Example: You should have seen a message alerted when entering this page.

Directions: Simply copy the below into the HEAD section of your page:


Code:
 
<script>

//Alert message once script- By JavaScript Kit
//Credit notice must stay intact for use
//Visit http://javascriptkit.com for this script

//specify message to alert
var alertmessage="Welcome to JavaScript Kit! \n http://javascriptkit.com"

///No editing required beyond here/////

//Alert only once per browser session (0=no, 1=yes)
var once_per_session=1


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 alertornot(){
if (get_cookie('alerted')==''){
loadalert()
document.cookie="alerted=yes"
}
}

function loadalert(){
alert(alertmessage)
}

if (once_per_session==0)
loadalert()
else
alertornot()

</script>



**It works in FOOTER
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Codes & Modifications · Next Topic »
Add Reply