Janka no Benzin Tanka Posted May 4, 2009 Report Posted May 4, 2009 Ir šāds skripts: <script type="text/javascript"> seconds = 5; // number of seconds to wait id = 'bsubmit'; id2 = 'txt'; onload = function() { timestamp = new Date(); time = timestamp.getTime(); } function countdown() { c_timestamp = new Date(); c_time = c_timestamp.getTime(); if (Math.floor((c_time - time)/1000) == seconds) { document.getElementById(id).disabled = false; document.getElementById(id2).style.visibility = 'hidden'; clearInterval(timer); } } timer = setInterval("countdown()", 1000); </script> <form method="post" name="frm" action="kautkas.php"> <p align="center"> <input type="submit" name="bsubmit" value="Close"> <? if ($_POST['bsubmit'] == "Close"){?> <input type="submit" name="bsubmit" id="bsubmit" value="Start" disabled="disabled" /> <Br> <div id=txt align=center class="style3">Please wait 5 seconds ...</div> <?}else{?> <input type="submit" name="bsubmit" value="Start"> <?}?> <?if ($_POST['bsubmit'] == "Start"){?> <div id=txt align=center class="style1">Please wait 5 seconds...</div> <?}?> </p> </form> Ko viņš dara? - Kad uzpiež pogu CLOSE, tad START pogu nevar uzpiest 5 sekundes. Kas šajā jomā spečuki, lūdzu pierakstat klāt rindiņas , lai kad uzpiež CLOSE pogu, tad nevar CLOSE pogu uzpiest 5 sek, un kad uzpiež START pogu, tad START pogu nevar uzpiest 5 sek. Quote
indoom Posted May 4, 2009 Report Posted May 4, 2009 Šito jau vajadzēja likt javascriptu sadaļā. Bet var darīt tā window.onload=function(){ if (document.getElementById('txt')) { setTimeout(function(){ document.frm.bsubmit.disabled=false; document.getElementById('txt').style.visibility='hidden'; },5000); } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.