dpwdldgn43486 2014-11-02 23:22
浏览 41
已采纳

jquery进度条与php变量

I would like to ask how can i use my own values for progress bar which will show how much credit u spent until your preset maximum budget? input types are text to see if value comes in. it does. Progress bar has some progress but that is because i manually entered both values. http://postimg.org/image/fbjnrvvgn/

CODE:

<input type="text" id="max_budget" value="<?php include_once 'budget_calc.php'; echo $max_budget_echo; ?>">
<input type="text" id="calculated_budget" value="<?php include_once 'budget_calc.php'; echo $total ?>">
<script>
$(function() {
$( "#progressbar" ).progressbar({
  max: 1000,
  value: 100
});
});
</script>
<div id="progressbar"></div>

I would like to have max from user set max in database and value calculated from $total=$i-$o, like this:

 <script>
$(function() {
$( "#progressbar" ).progressbar({
 max: $('#max_budget').val(),
  value: $('calculated_budget').val()
});
});
</script>

I have also tired this:

<script>
var max_budget=<?php include_once 'budget_calc.php'; echo $max_budget_echo; ?>
var calculated_budget=<?php include_once 'budget_calc.php'; echo $total; ?>
$(function() {
$( "#progressbar" ).progressbar({
max: max_budget,
value: calculated_budget
});
});
</script>

But nothig works :( How can i solve this problem? Thank you for your time (:

  • 写回答

2条回答 默认 最新

  • dongyi7901 2014-11-02 23:45
    关注

    Why dont you just 'echo' them where you need them?

    <?php include_once 'budget_calc.php'; ?>
    <script>
    $(function() {
    $( "#progressbar" ).progressbar({
    max: <?php echo $max_budget_echo; ?>,
    value: <?php echo $total; ?>
    });
    });
    </script>
    

    If this wont work, check your HTML/JS-Code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了