How to Join Member's Area Private Library Search Today's Topics p Login
Main Forums Discussion Tech Talk Mature Content Archives
   Nav Win
 Tech Talk
 Beyond the Basics
 JavaScript Question
 1 2 3 4 5 6 7 8 9
Follow us on Facebook

 Moderated by: Ron   (Admins )

 
User Options
Format for Better Printing EMail to a Friend Not Available
Admin Print Send ECard
Passions in Poetry

JavaScript Question

 Post A Reply Post New Topic   Go to the Next Oldest/Previous Topic Return to Topic Page Go to the Next Newest Topic 
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


0 posted 02-02-2001 07:29 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher


OK - here's the deal:
http://www.countlesshorizons.com/test

when you go to this page, then leave, a window will pop up. It has a few options on it. In theory, what it's supposed to do is set a cookie so that when you tell it that you don't want to see it again, you won't. But for some reason, I have something messed up and it doesn't write the cookie...? Any help here would be appreciated.

Thanks,

<!--  //
/*Cookie Controlled Pop Window - modified by Brad Richardson at speculativevision.com from original cookie script by echoecho.com*/

/* reads the cookie */
function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");      
    if (begin != -1) {          
      begin += NameOfCookie.length+1;      
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    }
  }
  return null;
}

/* deletes the cookie if a link is provided to do so */
function delCookie (NameOfCookie) {
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

/* pops up the window if the cookie has not been set */

function DoTheCookieStuff()
{
visited=getCookie('visited');
if (visited==null)
{
MyWindow=window.open('http://www.countlesshorizons.com/poems/subscribe1.htm',"subscription","toolbar=0, location=0,directories=0,status=no,menubar=no,scrollbars=no,resizable=no,width=640,height=480,left = 192, top = 144") }
}
// -->





Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


1 posted 02-02-2001 07:58 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

You have a function to read the cookie, one to delete the cookie, and one to open the popup based on the content of the cookie. But, Chris, you have nothing in the script to set a cookie.

Shouldn't the code to set the cookie be in subscribe1.htm any way?
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


2 posted 02-02-2001 08:49 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

And it is. Sorry for the confusion. The above code is in the include, brought in by the "main" page.

Here's what's on the subscribe1.htm:

<!--  //
/*
Cookie Controlled Pop Window -
modified by Brad Richardson at speculativevision.com
from original cookie script by echoecho.com
*/


/* sets the cookie */
function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

  document.cookie = NameOfCookie + "=" + escape(value) +
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


/* sets a default cookie in case the user closes the window  */
/* without using the links.  Change 30 to whatever you want it to be */

function SetDefault()
{
setCookie('visited','yes',30);
}


/* sets parameters for Remind Me link and closes pop up */
/* change 1 to set number of days for cookie to expire */

function SetRemindMe()
{
setCookie('visited','yes',1);
self.close();
}

/* sets parameters for Don't Remind Me link and closes pop up */
/* change 365 to set number of days for cookie to expire */

function SetDontRemindMe()
{
setCookie('visited','yes',365);
self.close();
}

//-->


*sigh*

LOL

Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


3 posted 02-02-2001 11:05 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

Your code is doing exactly what you have asked it to do, Chris. Here's the cookie it gave me (and the clue to your problem)

www.countlesshorizons.com FALSE /poems FALSE 1012707844 visited yes



[This message has been edited by Ron (edited 02-02-2001).]
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


4 posted 02-02-2001 11:28 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

And I still aren't smart enough to figure it out...

here's what it gave me: visited
yes www.countlesshorizons.com/poems/
0
1940402816
29402379
2069334176
29396344
*

And still no clue...

I feel stupid, but I'm not seeing what's wrong.

Chris

PS: I do "get" to see the horizontal scroll bar with those non-resizable pop-ups... (ie: Review Topic...)  
Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


5 posted 02-02-2001 11:55 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

Okay, here's another clue. Move test.html into your /poems directory and run it from there...

Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


6 posted 02-03-2001 12:21 AM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

*banging head against desk*

Thank you Ron. I haven't tried it, but I just heard a loud "click" in the room, and the radio's off.

Chris
DragonFang
Senior Member
since 03-09-2000
Posts 525
Missouri, USA


7 posted 02-03-2001 01:50 PM       View Profile for DragonFang   Email DragonFang   Edit/Delete Message      Find Poems   Click to visit DragonFang's Home Page   View IP for DragonFang

ACK!! COOKIES EVIL!!!!!!!
(I just say that becuase I've never understood how to use them... I really must get a book on javascript)

"Sa souvraya niende missian ye." \
I am lost in my own mind.

Nan
Administrator
Member Seraphic
since 05-20-99
Posts 24426
Cape Cod Massachusetts USA


8 posted 02-04-2001 09:02 AM       View Profile for Nan   Email Nan   Edit/Delete Message      Find Poems   Click to visit Nan's Home Page   View IP for Nan

.... and I have to return an accidentally borrowed one...
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


9 posted 02-06-2001 10:48 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

Ahhhhhhhhhhhhhhh!

MUCH better. Thank you Ron. Such a simple answer to what was proving to be a large headache!!!

Those interested in the results can visit http://www.countlesshorizons.com - The script will be activated when you leave the main page.

Chris
 
 Post A Reply Post New Topic   Go to the Next Oldest/Previous Topic Return to Topic Page Go to the Next Newest Topic 
All times are ET (US) Top
  User Options
>> Tech Talk >> Beyond the Basics >> JavaScript Question Format for Better Printing EMail to a Friend Not Available
Print Send ECard

 

pipTalk Home Page | Main Poetry Forums

How to Join | Member's Area / Help | Private Library | Search | Contact Us | Today's Topics | Login
Discussion | Tech Talk | Archives | Sanctuary



© Passions in Poetry and netpoets.com 1998-2013
All Poetry and Prose is copyrighted by the individual authors