简体   繁体   English

jQuery UI datepicker在IE7中不起作用

[英]jQuery UI datepicker doesn't work in IE7

I've have finally got the datepicker to work on my MVC demo site. 我终于得到了datepicker来在我的MVC演示站点上工作。 One thing though it doesn't work when browsing with IE7, I havn't testet with IE6 yet. 有一点虽然它在使用IE7浏览时不起作用,但我还没有尝试使用IE6。 Does anyone know how to fix this problem or can't I use jQuery if I want IE users to be able to pick dates? 有没有人知道如何解决这个问题,或者如果我希望IE用户能够选择日期,我不能使用jQuery?

It works like a charm on Safari and Firefox, except for it's position when dropping down. 它就像Safari和Firefox上的魅力一样,除了它在下降时的位置。

Please try for yourself on my demo site: Demo site 请在我的演示网站上试一试: 演示网站

Click the link "Boka plats" on the menu. 点击菜单上的“Boka plats”链接。 then login with: email: test@test.nu password: tester 然后登录:email:test@test.nu密码:tester

If I'm not mistaken, you have a trailing comma in your parameter list. 如果我没弄错,你的参数列表中有一个尾随逗号。 IE will choke on trailing commas all the time in js. IE将在js中一直在逗号尾随逗号。

Try this: 试试这个:

$(function() {            
    $("#Date").datepicker($.extend({},
       $.datepicker.regional["sv"], {
            onSelect: function(date) {
            }, 
            minDate: "0d",
            maxDate: new Date(2009, 3 - 1, 26),
            showStatus: true,
            showWeeks: true,
            highlightWeek: true, 
            showOn: "both",
            numberOfMonths: 1,
            firstDay: 1,
            buttonImage:"../../Content/Images/calendar.gif",
            buttonImageOnly: true,
            showAnim: "scale", 
            showOptions: { 
                origin: ["top", "left"] 
            }
    }));
});   

Is this helpful at all? 这有用吗?

EDIT: Yes, I think you need to wrap your DatePicker() in $(document).ready(function() EX: 编辑:是的,我认为你需要在$(document).ready(function()EX中包装你的DatePicker():

<script type="text/javascript"> 
        $(document).ready(function() {          
            $("#Date").datepicker($.extend({},
                $.datepicker.regional["sv"], {
                    onSelect: function(date) {
                        //alert("The chosen date is " + date);
                    }, 
                    minDate: "0d",
                    maxDate: new Date(2009, 3 - 1, 26),
                    showStatus: true,
                    showWeeks: true,
                    highlightWeek: true, 
                    showOn: "both",
                    numberOfMonths: 1,
                    firstDay: 1,
                    buttonImage:"../../Content/Images/calendar.gif",
                    buttonImageOnly: true,
                    showAnim: "scale", 
                    showOptions: { 
                        origin: ["top", "left"] 
                    }, 
                }));
        });   
    </script> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM