Tutorials to .com

Tutorials to .com » Asp » Encoding » Cookie achieve with only one pop-up window (JavaScript) (change)

Cookie achieve with only one pop-up window (JavaScript) (change)

Print View , by: iSee ,Total views: 6 ,Word Count: 196 ,Date: Wed, 27 May 2009 Time: 11:12 AM

Cookie achieve with only one pop-up window (JavaScript)


Script Description:
The first step: the following code to <head> region
<SCRIPT Language="JavaScript">
<! --
function openpopup () (
window.open ( "welcome.htm ",""," width = 300, height = 300")
)


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 loadpopup () (
if (get_cookie ( 'popped')==''){
openpopup ()
document.cookie = "popped = yes"
)
)

//-->
</ SCRIPT>


Step two: the contents of the <body> read:
<body bgcolor="#fef4d9" onunload="loadpopup()">


Asp Script encoding Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.