需要解决IE浏览器8 jQuery的问题 [英] Need to solve IE 8 Jquery problem

查看:111
本文介绍了需要解决IE浏览器8 jQuery的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的发展,我来了一个奇怪的问题。以下是我的jQuery code加载2日期选择器时,网页加载,这2 datepickers是禁用哪些不可用的日期,这里是code:

In my development, I came on a strange problem. The following is my jquery code to load 2 datepicker when the page load, those 2 datepickers are disable the dates which are not available, here is the code:

$(document).ready(function () {

                                $('#textfield1').datepicker( "destroy" );
                                $('#textfield2').datepicker( "destroy" );
                                $("#loading2").html('<img src="images/loading.gif"/>');
                                var dataString = 'a=b';
                                $.ajax({
                                    type: "GET",
                                    url: "include/getdate.php",
                                    data: dataString,
                                    success: function(data){

                                        $(".tempimg").hide();

                                        $("#textfield1hid").datepicker({ 
                                            showOn: "button",
                                            buttonImage: "/images/calendar.gif",
                                            buttonImageOnly: true,
                                            dateFormat: 'd M yy',
                                            altField: "#textfield1",
                                            altFormat: "yy-mm-dd",
                                            beforeShowDay: reservedDates
                                        });
                                        $("#textfield2hid").datepicker({ 
                                            showOn: "button",
                                            buttonImage: "/images/calendar.gif",
                                            buttonImageOnly: true,
                                            dateFormat: 'd M yy',
                                            altField: "#textfield2",
                                            altFormat: "yy-mm-dd",
                                            beforeShowDay: reservedDates
                                        });
                                        natDays = data;
                                        function reservedDates(date) {
                                            for (i = 0; i < natDays.length; i++) {
                                              if (date.getMonth() == natDays[i][0] - 1
                                                  && date.getDate() == natDays[i][1]) {
                                                return [false, natDays[i][2] + '_day'];
                                              }
                                            }
                                          return [true, ''];
                                        }
                                            $("#loading2").html('');
                                        }
                                    });
                                    return false;
                                });

这code工作正常在Firefox和IE7。但是,当它显示在IE8中,datepickers不加载,但Ajax响应被来自服务器。这是我的2文本字段

This code is working fine on Firefox and IE7. But when the it shows in IE8, the datepickers are not loading, but the ajax responses are coming from the server. These are my 2 text fields

<input type="text" name="textfield1hid" id="textfield1hid" />
                                    <input type="text" name="textfield2hid" id="textfield2hid" />

这是来自服务器的响应:

This is the response from the server:

[[04,01],[04,01],[04,02],[04,02],[04,03],[04,03]]

在IE8加载页面,仍然是文本字段,如下所示

After IE8 loaded the page, still the text fields are as shown below

<input name="textfield1hid" disabled="disabled" id="textfield1hid" style="background-color: #a0a0a4;" type="text"/>

下一个文本字段中也得到了相同的属性,我加入他们很久以前并删除所有这些,其他的浏览器都工作正常,甚至IE7,但问题是在IE8

the next text field also get the same attributes, and I added them a long time ago and removed them all, other browsers are working fine even IE7 but problem is in IE8

任何人都可以给我一个帮助解决这个问题。

Can anybody give me a help to solve this problem

推荐答案

您可以试试这个:

变化数据类型设置为文本

change dataType to text

和EVAL数据。

natDays =的eval('('+数据+')');

natDays = eval('(' + data + ')');

这篇关于需要解决IE浏览器8 jQuery的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆