02:32

Java Script Pop Up

This is the javascript (and HTML/CSS) to show a div the first time a user goes to a page but not the second time (or after a refresh or the user navigates away from the page).


I have used it to pop up a little un-obtrusive header that can be closed by clicking the cross.


The script is currently running on my martial arts clubs website.




<html>

<head>

        <style type="text/css">

        div.hidden {

        display: none;

        }

        div.pophead {

padding: 10px 0pt;

             text-align: center;

             font-family: Arial,Helvetica,sans-serif;

             font-size: 110%;

             font-weight: bold;

             background-color: #B7C134 !important;

                border:2px solid black;

             color: #111111;

             display: block;

             letter-spacing: 1px;

             line-height: 1;

             vertical-align: baseline;

}

      

</style>

    

<script type="text/javascript">

    function checkcookie() {

    popheaddiv=document.getElementById("pophead");

    if (document.cookie.indexOf("mycookie")!=-1) {

    popheaddiv.style.display="none";

    }

    else {

    document.cookie="mycookie=1";

    }

    }

</script>



</head>



<body>



</div>

<div class="pophead" id="pophead">

        New <a style="color: white !important; text-decoration:none" href="a link">Putney class</a> starts in the sports centre on the 1st of November! <a href="#" onclick="change('pophead', 'hidden');"><img src="/assets/2009/10/27/psd-delete-icon.png" width="16px" align="right" style="margin-right:80px;"></a> </div>



    <script type="text/javascript">

    <!--//check for the cookie and display div or set cookie

    checkcookie();

    -->

    </script>



<p> Main Page Body to Go Here :) </p>



    </body>

    </html>


11:41

Hello All

Hi and welcome


Ok so I though it would be a good idea to keep track of all the web stuff I'm working on. My "ToDo" list is getting big and and it would be handy to have some backups here
as I forget what I have done.

About me:

I like Martial Arts, Rock Climbing, Cooking and lots of other things about life, too many to list maybe.

Technologies I use, or steal and adapt:

- (X)HTML written in Notepad, which only remembers one undo! Crazy I know but I don't want to pay for anything!
- CSS for style
- JavaScript for image galleries, image mapping and cookies for remembering you
- Java which I am still learning this for my job (with BSkyB) but hope to get some jdbc and interactive content live soon

Web content I am to blame for:

www.kwokwingchun.co.uk <- my wing chun instructors site

www.southfieldswingchun.co.uk <- my martial arts club website

www.eastern-arts.co.uk <- my friends business enterprise