JavaScript
  Home arrow JavaScript arrow Page 2 - Boosting Ezine Subscribers With a Popup Wi...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Boosting Ezine Subscribers With a Popup Window
By: Mitchell Harper
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2002-04-17

    Table of Contents:
  • Boosting Ezine Subscribers With a Popup Window
  • A Popup is the Answer
  • How setCookie Is Used
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Boosting Ezine Subscribers With a Popup Window - A Popup is the Answer


    (Page 2 of 4 )

    The technique I'm about to describe is one of the best I've ever used to attract more subscribers to the devArticles ezine, called devXpress. Firstly, it involves the creation of a popup window using JavaScript. Like many other Webmasters, I once thought that using a popup window degraded the professionalism of my site. Boy was I wrong!

    Adding a simple signup popup to my site increased my ezine subscriptions from about 20 a day to well over 100! No joke.

    Visitors don't want to be annoyed by popup windows every time they visit your site, however. This is where cookies come into play. Using cookies, you can make their browser "remember" if your ezine signup page has already been displayed. If it has, then the page won't be displayed again.

    Getting and Setting the Cookie
    To start with, we need to create the generic functions that will actually get and set the cookies from the user's browser. To access the visitor's cookies through JavaScript, we manipulate the document.cookie value. It contains all the cookies that have been set for this user when they visit our site. It's important to note that we can only access the cookies that we have set, and not those set by other sites.

    Cookies are stored by the Web browser in a plain text file on the visitor's computer. The browser checks the cookie file on their hard drive to see whether it contains any cookies for our site; if it does, the browser loads them automatically for us.

    Each cookie is stored as a name/value pair. A sample document.cookie variable looks like this:

    myCookie=myValue;myName=Mitchell;mySite=www.devarticles.com;

    We will create two functions named setCookie and getCookie. They're created between <script> and </script> tags, just before the </head> tag of our HTML page, like this:

    <script language= "JavaScript">

    function setCookie(cookieName, cookieValue, cookiePath,
    cookieExpires)
    {

    cookieValue = escape(cookieValue);
    if (cookieExpires == "")
    {
    var nowDate = new Date();
    nowDate.setMonth(nowDate.getMonth() + 6);
    cookieExpires = nowDate.toGMTString();
    }

    if (cookiePath != "")
    {
    cookiePath = ";Path=" + cookiePath;
    }

    document.cookie = cookieName + "=" + cookieValue +
    ";expires=" + cookieExpires + cookiePath;
    }

    function getCookie(name)
    {
    var cookieString = document.cookie;
    var index = cookieString.indexOf(name + "=");

    if (index == -1)
    {
    return null;
    }

    index = cookieString.indexOf("=", index) + 1;
    var endstr = cookieString.indexOf(";", index);

    if (endstr == -1)
    {
    endstr = cookieString.length;
    }

    return unescape(cookieString.substring(index, endstr));
    }
    </script>

    More JavaScript Articles
    More By Mitchell Harper


     

    JAVASCRIPT ARTICLES

    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in
    - Active Client Pages at the Server
    - ACP Tab Web Page







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT