www.webdeveloper.com
Results 1 to 4 of 4

Thread: Need Help With Java/PHP compatability.

  1. #1
    Join Date
    Jan 2011
    Posts
    4

    Need Help With Java/PHP compatability.

    well i have this simple countdown script my friend made for me:
    Code:
    <script> 
    <!-- 
    // 
     var milisec=0 
     var seconds=30
     document.counter.d2.value='30' 
    
    function display(){ 
     if (milisec<=0){ 
        milisec=9 
        seconds-=1 
     } 
     if (seconds<=-1){ 
        milisec=0 
        seconds+=1 
     } 
     else 
        milisec-=1 
        document.counter.d2.value=seconds+"."+milisec 
        setTimeout("display()",100) 
    } 
    display() 
    --> 
    
    </script>
    this is a countdown script, now its set to countdown from 30 sec.
    now, what i need help with is this:
    1. putting a varriable instead of the secs wich is declared in php ($time for example)
    2. adding minutes countdown aswell, i tryed different ways, failed at all of them, so if some1 could help, would be appritiated.!

  2. #2
    Join Date
    Jan 2011
    Posts
    4
    ok i fixed the copitability issue, now, i cant seem to make the mins work....
    here is the code, tell me wts wrong with it p.s i know i suck with javascript...
    Code:
    <script> 
    <!-- 
    // 
     var milisec=0 
     var seconds=$time 
     document.counter.d2.value=$time 
    
    function display(){ 
     if (milisec<=0){ 
        milisec=9 
        seconds-=1 
     } 
     if (seconds<=-1){ 
        milisec=0 
        seconds+=1 
     } 
     else 
        milisec-=1 
        document.counter.d2.value=seconds+"."+milisec 
        setTimeout("display()",100) 
    } 
    display() 
    --> 
    
    </script>

  3. #3
    Join Date
    Jan 2011
    Posts
    4
    ffs the web dont let me edit the post, here is the script:
    Code:
    <?PHP 
    $time = 16;
    echo $time;
    
    echo "<head>
    <form name='counter'><input type='text' size='8' 
    name='d2'></form> 
    
    <script> 
    <!-- 
    // 
     var mins=5
     var milisec=0 
     var seconds=$time
     document.counter.d2.value='$time' 
    
    function display(){ 
     if (milisec<=0){ 
        milisec=9 
        seconds-=1 
     } 
     if (seconds=0){
    	seconds=60
    	mins-=1
     }
     if (seconds<=-1){ 
        milisec=0 
        seconds+=1 
     } 
     else 
        milisec-=1 
        document.counter.d2.value=min+'.'+seconds+'.'+milisec 
        setTimeout('display()',100) 
    } 
    display() 
    --> 
    
    </script>
    </head>";

  4. #4
    Join Date
    Jan 2011
    Posts
    4
    ok i managed to do it >< seems its just been a syntax error ><

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles