Jump to content
php.lv forumi

Par laiku atskaitēm


sandrulis

Recommended Posts

Man ir vajadzīga palīdziba at laiku atskaiti!

 

Doma tāda, ar JavaScript panākt tā, ka laika atskaita sākas no 30 sec un līdz 0,

ja laika atskaite ir tikusi uz 0, tad automatiski, lapa tiek pārlādēta uz citu.

Nu piemērām vis notiek lapa1, bet kad javascrip tiek uz 0, tad ar šādu funkciju (<meta http-equiv="refresh" content="0;url=lapa2">),

bet protams var gan jau ar citu ar!

Link to comment
Share on other sites

Kaut kā šitā

<span id="laika-atskaite">30</span>
<script type="text/javascript">
var laiks = 30;
function update(){
	laiks--;
	document.getElementById("laika-atskaite").innerHTML = laiks;
	if(laiks == 0){
		document.location.href = 'http://cita.lapa';
		return;
	}
	window.setTimeout('update()', 1000);
}
window.onload = function(){
	update();
}
</script>

Link to comment
Share on other sites

Kaut kā šitā

<span id="laika-atskaite">30</span>
<script type="text/javascript">
var laiks = 30;
function update(){
	laiks--;
	document.getElementById("laika-atskaite").innerHTML = laiks;
	if(laiks == 0){
		document.location.href = 'http://cita.lapa';
		return;
	}
	window.setTimeout('update()', 1000);
}
window.onload = function(){
	update();
}
</script>

 

 

O, paldies, šis ritīgais! :)

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...