使用if else设置滑块的值

时间:2013-06-22 06:46:33

标签: jquery slider

我有类似的东西

$maxvalue = ($data['any'] > 0 ? $site['any'] : $site['any']);

我想根据上面的查询在滑块中设置最大值,这里是滑块的代码

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>jQuery UI Slider - Range with fixed maximum</title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css" />
        <script>
            $(function() {
                $( "#slider-range-max" ).slider({
                        range: "max",
                        min: 10,
                        max: 60,
                        value: 10,
                        slide: function( event, ui ) {
                            $( "#amount" ).val( ui.value );
                        }
                });
                $( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
            });
        </script>
    </head>
    <body>
        <p>
            <label for="amount">Minimum number of bedrooms:</label>
            <input type="text" id="amount" style="border: 0; color: #f6931f; font-weight: bold;" />
        </p>
        <div id="slider-range-max"></div>
    </body>
</html>

我该怎么做?如果还有其他滑块代码,请发布。


我使用

工作了
max: "<?php echo $maxvalue; ?>",

现在如何在提交后获得滑块值?

编辑 - 没有回复,我发现自己回答 只需改变这个

<input type="text" id="amount" style="border: 0; color: #f6931f; font-weight: bold;" />

<input type="text" id="cpc" name="cpc" style="border: 0; color: #f6931f; font-weight: bold;" />

您可以设置name = any值,并在其他页面上通过POTS_获取此值,就像论坛提交一样。

1 个答案:

答案 0 :(得分:0)

使用此

$maxvalue = any query ;
max: "<?php echo $maxvalue; ?>",