Jump to content
php.lv forumi

Palīdzat ar input...


Recommended Posts

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.

Link to comment
Share on other sites

Š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);
 }
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...