Team:Alberta/Templates/Header

From 2012.igem.org

(Difference between revisions)
Line 274: Line 274:
<script>
<script>
-
 
-
$(document).ready( function() {
 
-
 
-
//var index = readCookie("lastClick");
 
-
alert("Hello");
 
-
 
-
});
 
function showSubMenu(menu, parent) {
function showSubMenu(menu, parent) {
Line 293: Line 286:
     $(menu). offset({top: 100 + 30 * $('.headerMenu').index($(parent) )} );
     $(menu). offset({top: 100 + 30 * $('.headerMenu').index($(parent) )} );
      
      
-
}
 
-
 
-
$("li").click( function() {
 
-
 
-
var index = $('li').index(this);
 
-
writeCookie("lastClick, index, 1);
 
-
 
-
});
 
-
 
-
function writeCookie(name,value,days) {
 
-
    var date, expires;
 
-
    if (days) {
 
-
        date = new Date();
 
-
        date.setTime(date.getTime()+(days*24*60*60*1000));
 
-
        expires = "; expires=" + date.toGMTString();
 
-
            }else{
 
-
        expires = "";
 
-
    }
 
-
    document.cookie = name + "=" + value + expires + "; path=/";
 
-
}
 
-
 
-
function readCookie(name) {
 
-
    var i, c, ca, nameEQ = name + "=";
 
-
    ca = document.cookie.split(';');
 
-
    for(i=0;i < ca.length;i++) {
 
-
        c = ca[i];
 
-
        while (c.charAt(0)==' ') {
 
-
            c = c.substring(1,c.length);
 
-
        }
 
-
        if (c.indexOf(nameEQ) == 0) {
 
-
            return c.substring(nameEQ.length,c.length);
 
-
        }
 
-
    }
 
-
    return '';
 
}
}
</script>
</script>

Revision as of 15:09, 26 September 2012