Results 1 to 2 of 2

Thread: count down doesnt work right

  1. #1
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default count down doesnt work right

    hi, im making a fishing skil on my rpg with php and javascript

    i have made up a simple code that delays the player when their setting up the rod, when i got to the bit where they cast it, it doesnt count down anymore.

    can anyone help me?
    Code:
    <table>
    <tr>
    <td style= align="center" width="250" height="23">
    <div id="message_html" class="messagehtml" style="font: Arial; font-weight: normal;   font-size: 13px;   color: black; }">Please enable javascript</div>
    </td>
    </tr>
    </table>
    <script language='Javascript'>
    setup=10;
    casting=5;
    waiting=10;
    
    function countdown()
    {
    if ((0 <= 100) || (0 > 0))
    {
    setup--;
    if(setup == 0)
    {
    if (0)
    document.getElementById("messagehtml").innerHTML = 'you set up your line';
    if (0)
    document.getElementById("message_html").innerHTML = 'you set up your line';
    document.getElementById("message_html").innerHTML = '<a class="messagehtml"  onclick="cast();"><u>Cast your line</u></font></a>';
    }
    if(setup > 0)
    {
    document.getElementById("message_html").innerHTML = 'seting up line '+setup+'';
    setTimeout('countdown()',1000);
    }
    }
    }
    countdown();
    
    if(setup == 0){
    function cast()
    {
    if ((0 <= 100) || (0 > 0))
    {
    casting--;
    if(casting == 0)
    {
    if (0)
    document.getElementById("messagehtml").innerHTML = 'you set up your line';
    if (0)
    document.getElementById("message_html").innerHTML = 'you cast out your line';
    document.getElementById("message_html").innerHTML = '<a class="messagehtml"  onclick="check();">check bait</font></a>';
    }
    if(casting > 0)
    {
    document.getElementById("message_html").innerHTML = 'casting out line '+casting+'';
    setTimeout('countdown2()',1000);
    }
    }
    }
    
    cast(); }
    
    
    function SetCookie(cookieName,cookieValue,nHours)
    				{
    					var today = new Date();
    					var expire = new Date();
    					if (Hours==null || nHours==0) Hours=1;
    					expire.setTime(today.getTime() + 3600000*Hours);
    					document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
    				}
    				</script>

  2. #2
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default solved!

    solved

    when i first made th code i just copied and pasted the first bit,
    i had this
    setTimeout('countdown2()',1000);

    instead of
    setTimeout('cast()',1000);

Bookmarks

Posting Permissions

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