Cookie issues :(
by "Antonio R." <aroh2002(at)hotmail.com>
|
| Date: |
Tue, 17 Dec 2002 21:31:50 -0700 |
| To: |
"'Languages'" <hwg-languages(at)hwg.org> |
| |
todo: View
Thread,
Original
|
|
Hi:
I=92m having a problem with a cookie. I m using the following code:
*****************************************************************
<script>
//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts
function openpopup(){
var popurl=3D"http://www.hombredehoy.net/enc.html"
winpops=3Dwindow.open(popurl,"","width=3D400,height=3D550,")
}
function get_cookie(Name) {
var search =3D Name + "=3D"
var returnvalue =3D "";
if (document.cookie.length > 0) {
offset =3D document.cookie.indexOf(search)
if (offset !=3D -1) { // if cookie exists
offset +=3D search.length
// set index of beginning of value
end =3D document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end =3D=3D -1)
end =3D document.cookie.length;
returnvalue=3Dunescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadornot(){
if (get_cookie('poppedup')=3D=3D''){
openpopup()
document.cookie=3D"poppedup=3Dyes"
}
}
loadornot()
</script>
*****************************************************************
As long as I know, it sets a cookie that tells the browser to open a
pop-up window just once, and that is the way I want it but if I close
the browser and open it again in the same session or in another one the
cookie doesn=92t works and it opens the pop-up window once again.
I really know nothing about cookies (this is the first time I=92m using
one) and almost nothing about JavaScript, so can anyone help me and
modify this script for me so that the pop-up window only opens once no
matter how many times the visitor comes to my site?
Antonio R.
http://www.HombredeHoy.net
AROH2002(at)Hotmail.com
ICQ: 18319148
"Dream as if you'll live forever. Live as if you'll die today."=20
"Sue=F1a como si fueras a vivir por siempre. Vive como si fueras a morir
hoy."=20
James Dean (1931-1955)
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.