Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Chistmas Advent calendar help - please

    HI I have this little script for a advent calendar that is working ok, but I would so much like to change the order of my dates of december so that they are not listed from 1-24. Can anyone help me how to do this?

    Is it posible to add a color for the visited state of the button so that it could have a color when I have seen it once. Perhaps with a picture or color.

    Thanks so very much

    Lars


    {
    /* ###############################################
    /* change the image name in the line below to your background image
    /* ############################################### */
    background-image:url(chistmasbackground.jpg);
    background-repeat: no-repeat;
    alignment-adjust:middle;
    background-position: left top;
    background-color: #3975b4;
    }


    .button
    {
    color:#FFFFFF; /* text colour on your door */
    width:100px;
    height:100px;
    text-align:center;
    margin:4px;
    font-family:sans-serif;
    font-size:large;
    padding:4pt;
    border-width: 6pt;
    border-style:ridge;
    text-decoration:none;
    }

    .button:hover
    {
    color:#99CC33; /* background colour on your door when moused over */
    width:100px;
    height:100px;
    text-align:center;
    margin:4px;
    font-family:sans-serif;
    font-size:large;
    padding:4pt;
    '
    border-width: 6pt;
    border-style:ridge;
    border-width: 6pt;
    border-styleutset;
    text-decoration:none;
    }
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>

    <body ondragstart="return false" onselectstart="return false"

    >

    <script language=JavaScript> var message="Function Disabled!"; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script>
    <script>

    function dooropen(door)
    {

    today=new Date();
    daynow=today.getDate();
    monthnow=today.getMonth();

    // ###############################################
    // I've de-activated the date controls for testing purposes
    // Before launching, you should remove the // from the start of the next three lines that start with 'if'
    // That will ensure that people can't use the calendar before December or after January
    // And that they can't open doors early
    // ###############################################

    if (monthnow!=10 && monthnow!=0) {alert("Julekalenderen åbner den 1. december. Kom tilbage denne dag og åbn første låge i kalenderen.."); return false;}
    if (daynow==door-1) {alert("Kom tilbage i morgen for at se hvad der gemmer sig bag denne låge.!");return false;}
    if (door>daynow) {alert("Du må vente "+(door-daynow)+" dage før du kan åbne denne låge!"); return false;}

    // you don't need to edit this bit
    oNewWindow=window.open(urlsarray[door], '_blank','directories=no,height='+heightarray[door]+',width='+widtharray[door]+',location=0,scrollbars=yes,menubar=0,resizable=yes');
    }

    urlsarray = new Array();
    widtharray = new Array();
    heightarray = new Array();
    scrollbarsarray= new Array();

    // ###############################################
    // edit variables here
    // ###############################################

    var x=30; // offset from left where doors begin in px
    var y=90; // offset from top where doors begin in px
    var rows=4; // number of rows of doors
    var cols=6; // number of columns of doors
    var spacinghoriz=140; // spacing between doors horizontal in px
    var spacingvert=140; // spacing between doors vertical in px


    // ###############################################
    // put your URLs, width and height in here. the scrollbarsarray[] is optional and should be set to 1 to enable scrollbars
    // ###############################################

    urlsarray[1]="indexJUL.php?option=com_content&view=article&id=3&Itemid=110"; widtharray[1]="800"; heightarray[1]="650";
    urlsarray[2]="indexJUL.php?option=com_content&view=article&id=4&Itemid=111"; widtharray[2]="800"; heightarray[2]="650";
    urlsarray[3]="indexJUL.php?option=com_content&view=article&id=5&Itemid=112"; widtharray[3]="800"; heightarray[3]="650";
    urlsarray[4]="indexJUL.php?option=com_content&view=article&id=6&Itemid=110"; widtharray[4]="800"; heightarray[4]="650"; scrollbarsarray[4]=1;

    // ###############################################
    // The first four doors work - I've provided sample doors for you to test with
    // Try opening the rest of the doors and you'll get an error message until you've added your doors in below
    // ###############################################

    urlsarray[5]="indexJUL.php?option=com_content&view=article&id=7&Itemid=112"; widtharray[5]="800"; heightarray[5]="650";
    urlsarray[6]="indexJUL.php?option=com_content&view=article&id=8&Itemid=113"; widtharray[6]="800"; heightarray[6]="650";
    urlsarray[7]="indexJUL.php?option=com_content&view=article&id=9&Itemid=122"; widtharray[7]="800"; heightarray[7]="650";
    urlsarray[8]="indexJUL.php?option=com_content&view=article&id=10&Itemid=123"; widtharray[8]="800"; heightarray[8]="650";
    urlsarray[9]="indexJUL.php?option=com_content&view=article&id=11&Itemid=124"; widtharray[9]="800"; heightarray[9]="650";
    urlsarray[10]="indexJUL.php?option=com_content&view=article&id=12&Itemid=125"; widtharray[10]="800"; heightarray[10]="650";

    urlsarray[11]="indexJUL.php?option=com_content&view=article&id=13&Itemid=126"; widtharray[11]="800"; heightarray[11]="650";
    urlsarray[12]="indexJUL.php?option=com_content&view=article&id=14&Itemid=127"; widtharray[12]="800"; heightarray[12]="650";
    urlsarray[13]="indexJUL.php?option=com_content&view=article&id=15&Itemid=128"; widtharray[13]="800"; heightarray[13]="650";
    urlsarray[14]="indexJUL.php?option=com_content&view=article&id=16&Itemid=129"; widtharray[14]="800"; heightarray[14]="650";
    urlsarray[15]="indexJUL.php?option=com_content&view=article&id=17&Itemid=130"; widtharray[15]="800"; heightarray[15]="650";
    urlsarray[16]="indexJUL.php?option=com_content&view=article&id=18&Itemid=131"; widtharray[16]="800"; heightarray[16]="650";
    urlsarray[17]="indexJUL.php?option=com_content&view=article&id=19&Itemid=132"; widtharray[17]="800"; heightarray[17]="650";
    urlsarray[18]="indexJUL.php?option=com_content&view=article&id=20&Itemid=133"; widtharray[18]="800"; heightarray[18]="650";
    urlsarray[19]="indexJUL.php?option=com_content&view=article&id=21&Itemid=134"; widtharray[19]="800"; heightarray[19]="650";
    urlsarray[20]="indexJUL.php?option=com_content&view=article&id=22&Itemid=135"; widtharray[20]="800"; heightarray[20]="650";

    urlsarray[21]="indexJUL.php?option=com_content&view=article&id=23&Itemid=136"; widtharray[21]="800"; heightarray[21]="650";
    urlsarray[22]="indexJUL.php?option=com_content&view=article&id=24&Itemid=137"; widtharray[22]="800"; heightarray[22]="650";
    urlsarray[23]="indexJUL.php?option=com_content&view=article&id=25&Itemid=138"; widtharray[23]="800"; heightarray[23]="650";
    urlsarray[24]="indexJUL.php?option=com_content&view=article&id=26&Itemid=139"; widtharray[24]="800"; heightarray[24]="650";


    // you don't need anything below this line
    var doorno=1;
    for (h=0;h<rows;++h)
    {
    for(g=0; g<cols; ++g, ++doorno)
    {
    document.write('<a class="button" onClick="dooropen('+doorno+');" href="#" style="position: absolute; left:'+(x+(g*spacinghoriz))+'px; top:'+(y+(h*spacingvert))+'px;">'+doorno+'</a>');}
    }
    </script>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    When posting here please help us to help you by following the posting guidelines and wrapping your code in CODE tags. It should be obvious why this is necessary. This means use the octothorpe or # button on the toolbar. You can (and should) edit your previous post.

    And you need to format the code with line breaks so that other people do not have to disentangle it.

    This is terribly old code. Netscape 4 is long defunct. All browsers use document.getElementById() now. <script language = "Javascript"> is also long obsolete.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 11-13-2012 at 12:46 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •