1

我在我的 MVC3 应用程序中使用 Range Slider,

我想在通过 JavaScript 更改滑块后更改窗口位置

这该怎么做?

我的代码

    <script type="text/javascript">
                    $(function () {
                        $("#slider-range").slider({
                            range: true,
                            min: "0",
                            max: "@To",
                            values: ['@from', '@To'],
                            slide: function (event, ui) {
                                $("#amount").val("Rs. " + ui.values[0] + " - Rs. " + ui.values[1]);
                            }
                        });
                        $("#amount").val("Rs. " + $("#slider-range").slider("values", 0) + " - Rs. " + $("#slider-range").slider("values", 1));
                    });   

 slide: function (event, ui) {
           var url = '@Url.RouteUrl("Category", new { categoryId = "_documentId_" })';
           var finalUrl = url.replace('_documentId_', '@catId' + "?price=1000-1200");
           window.location.href = finalUrl;
                    }
        </script>
4

1 回答 1

0
<script type="text/javascript">
                $(function () {
                    $("#slider-range").slider({
                        range: true,
                        min: "0",
                        max: "@To",
                        values: ['@from', '@To'],
                        slide: function (event, ui) {
                            $("#amount").val("Rs. " + ui.values[0] + " - Rs. " + ui.values[1]);
                            var url = '@Url.RouteUrl("Category", new { categoryId = "_documentId_" })';
                            var finalUrl = url.replace('_documentId_', '@catId' + "?price=1000-1200");
                            window.location.href = finalUrl;
                        }
                    });
                    $("#amount").val("Rs. " + $("#slider-range").slider("values", 0) + " - Rs. " + $("#slider-range").slider("values", 1));
                });   

slide: function (event, ui) {

                }
    </script>
于 2013-04-18T05:49:05.720 回答