Jump to content
php.lv forumi
  • 0

Lādējās


Snaip3Rs

Question

Kā varētu pielikt klāt līniju kas Virs datuma lādējās piemēram 15 dienas svītra pilna un rāda virs svitras 100% bet kad paliek 5 dienas rāda 35% un svītra ar ir pagājusi uz priekšu!

Tādu kā loading bar vēlētos bet nevaru nekur atrast!

Un lūkur kods ar ko vajag apvienot!

<script  language="javascript"  type="text/javascript">
<!-- Begin
function getTime() {
now = new Date();
y2k = new Date("FEB 16 2010 1:30:00");
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
sec = (secondsRound == 1) ? " second." : " sekundes.";
min = (minutesRound == 1) ? " minute" : " minutes, ";
hr = (hoursRound == 1) ? " hour" : " stundas, ";
dy = (daysRound == 1)  ? " day" : " dienas, "
document.timeForm.input1.value = "Atlicis: " + daysRound  + dy + hoursRound + hr + minutesRound + min + secondsRound + sec;
newtime = window.setTimeout("getTime();", 1000);
}
window.onload=getTime;
//  End -->
</script>Restock:  14/02/10 2:30:00
<form name=timeForm>
<input type=text name=input1 size=70 border-style="none" style="border-bottom: 0px solid; border-left: 0px solid;border-right: 0px 

solid;border-top: 0px solid;font:14px arial, helvetica,sans-serif">
</form>

 

Labots!

Lūkur es atradu progres bar, bet lūdzu vai jūs varētu palīdzēt apvienot lai viņš iet uz priekšu kopā ar laiku lai zinātu cik ir atlicis un rādītu laiku!

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Css Progress Bar">
</meta>

<style>
body {
margin:0;
padding:40px;
background:#fff;
font:70% Arial, Helvetica, sans-serif;
color:#555;
line-height:180%;
}

h1{
font-size:180%;
font-weight:normal;
color:#555;
}


/* DEFINITION LIST PROGRESS BAR */

dl, dt, dd{margin:0;padding:0;}

dd{
width:216px;
height:41px;
background:url(bg_bar.gif) no-repeat 0 0;
position:relative;
}
dd span{
position:absolute;
display:block;
width:200px;
height:25px;
background:url(bar.gif) no-repeat 0 0;
top:8px;
left:8px;
overflow:hidden;
text-indent:-8000px;
}
dd em{
position:absolute;
display:block;
width:200px;
height:25px;
background:url(bg_cover.gif) repeat-x;
top:0;
}


/* SINGLE PROGRESS BAR */

.progressBar{
width:216px;
height:41px;
background:url(bg_bar.gif) no-repeat 0 0;
position:relative;
}
.progressBar span{
position:absolute;
display:block;
width:200px;
height:25px;
background:url(bar.gif) no-repeat 0 0;
top:8px;
left:8px;
overflow:hidden;
text-indent:-8000px;
}
.progressBar em{
position:absolute;
display:block;
width:200px;
height:25px;
background:url(bg_cover.gif) repeat-x 0 0;
top:0;
}

</style>
</head>
<body>

<dl>
	<dd>
		<span><em style="left:160px">80%</em></span>
	</dd>
		</dl>

</body>
</html>

Edited by Snaip3Rs
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

css ftw :))

<div style="overflow: hidden">
 <div style="background: #f5f5f5; border: 1px solid #555; float: left; width: 160px; height: 10px; padding: 1px">
   <div style="background: #aaa; width: 35%; height: 100%"></div>
 </div>
 <span style="font: 11px Verdana, sans-serif; margin-left: 3px">35%</span>
</div>

progress-bar_1264968125.png

Link to comment
Share on other sites

  • 0

Vari lūdzu man apvienot ar ladešanās līniju šo atskaiti! :)

 

<script  language="javascript"  type="text/javascript">
<!-- Begin
function getTime() {
now = new Date();
y2k = new Date("FEB 16 2010 1:30:00");
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
sec = (secondsRound == 1) ? " second." : " sekundes.";
min = (minutesRound == 1) ? " minute" : " minutes, ";
hr = (hoursRound == 1) ? " hour" : " stundas, ";
dy = (daysRound == 1)  ? " day" : " dienas, "
document.timeForm.input1.value = "Atlicis: " + daysRound  + dy + hoursRound + hr + minutesRound + min + secondsRound + sec;
newtime = window.setTimeout("getTime();", 1000);
}
window.onload=getTime;
//  End -->
</script>Restock:  14/02/10 2:30:00
<form name=timeForm>
<input type=text name=input1 size=70 border-style="none" style="border-bottom: 0px solid; border-left: 0px solid;border-right: 0px 

solid;border-top: 0px solid;font:14px arial, helvetica,sans-serif">
</form>

 

Piemēram ir 1h 40 min ir 0% paliek 1h 60% kautkā tā! Jo es to atskaites laiku visu laiku mainu!

Un paldies par šo vienkāršo skriptu 2easy man bija sarežģītāks! :)

 

kautko tādu līdzīgu piemēram apakšā atlikušais laiks un augšā šis tavs dotais loading bar!

xiwd9s57o7aii0mnvprw.jpg

Edited by Snaip3Rs
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
Answer this question...

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