對所有我有一個問題,或者更確切地說是我一直在互聯網上研究如何放置進度條的問題。他們都使用 style 方法給出百分比。如果有人可以支持我,我想在我用 php 撰寫的代碼中添加一個進度條。我將不勝感激。
正如您在 my% total time 的影像中看到的那樣,它已經顯示了 %. 現在我想用進度條顯示該百分比。
我試圖展示它,但它只需要我一張唱片。
<br><br>
<div class="barra">
<div class="progreso"><div class="porcentaje"></div></div>
</div>
<script type="text/javascript">
document.getElementsByClassName("progreso")[0].style.width = "<?php echo $porcentaje; ?>%";
document.getElementsByClassName("porcentaje")[0].innerHTML = "<?php echo $porcentaje; ?>%";
</script>
<?php
@ob_flush();
flush();
$total = substr($user->finish, 0, 4) -substr($user->start, 0, 4) 1;
$current = substr($user->diasf, 0, 4);
$porcentaje = ($current/$total) * 100;
$porcentaje = round($porcentaje, 0);
?>
<?php
@ob_flush();
flush();
usleep(500);?>
<thead>
<th style=""; class="button-3"> Persona Asignada</th>
<th style=""; class="button-4"> Tarea</th>
<th style=""; class="button-3">Descripcion</th>
<th style=""; class="button-3">Dias Asignados</th>
<th style=""; class="button-3">Dia Finalizado</th>
<th style=""; class="button-3">% Total tiempo</th>
</thead>
<?php
foreach($users as $user){
?>
<tr>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->persona, 0, 200);; ?></td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->title, 0, 200);; ?></td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->description, 0, 200);; ?></td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->finish, 0, 200)-substr($user->start, 0, 200) 1;; ?> Dias</td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->diasf, 0, 200);; ?> Dias</td>
<td class="bg-info text-white" style="color:#070001">
<?php
$total = substr($user->finish, 0, 4) -substr($user->start, 0, 4) 1;
$current = substr($user->diasf, 0, 4);
$percent = ($current/$total) * 100;
$percent = round($percent, 0);
// echo "$current es $percent% of $total.
// <p />";
?>
uj5u.com熱心網友回復:
這就是沒有 javascript 的情況。
<?php foreach($users as $user){ ?>
...
<td class="bg-info text-white" style="color:#070001; width:200px;">
<?php
$total = substr($user->finish, 0, 4) - substr($user->start, 0, 4) 1;
$current = substr($user->diasf, 0, 4);
$percent = ($current/$total) * 100;
$percent = round($percent, 0);
?>
<div class="barra" style="background: #EEE; width: 100%; height: 10px; position: relative;">
<div class="progreso" style="height: 100%; width: <?=$percent?>%; background: green;"><div class="porcentaje"></div></div>
</div>
</td>
<?php } ?>
需要自定義的地方;
- td樣式中的寬度值。(寬度:200px)
- barra div樣式中的背景值。(背景:#EEE;高度:10px)
- progreso div樣式中的背景值。(背景:綠色)
uj5u.com熱心網友回復:
在這里,我展示了它的外觀示例,感謝 Emrah Tuncel 的支持
在此處輸入圖片說明
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/371115.html
標籤:javascript php html css
上一篇:AndroidStudio-在主活動中定義需要背景關系和屬性的類
下一篇:ReactNativeComponentException:undefined不是一個物件(evaluating_useContext.isAuthenticated
