jquery ie7 don't read script
Hi Everyone.
I have some problem with my jquery/javascript code.
Every browser (except Internet Exploder 7) read and executes the code.
In IE7 looks like the code is not read - I have a few hidden fields - all are visible.
I try with:
$
(
document
).
ready
(
function
() but nothing change.
- var disabledDays = ['15/8/2012', '1/11/2012', '11/11/2012', '25/12/2012', '26/12/2012'];
- function nationalDays(date) {
- var m = date.getMonth(),
- d = date.getDate(),
- y = date.getFullYear();
- for (i = 0; i < disabledDays.length; i++) {
- if ($.inArray(d + '/' + (m + 1) + '/' + y, disabledDays) != -1 || new Date() > date) {
- return [false];
- }
- }
- return [true];
- }
- $(function () {
- $("#date_from, #date_to").datepicker({
- defaultDate: "+1d",
- minDate: "+1d",
- changeMonth: true,
- changeYear: true,
- dateFormat: "dd/mm/yy",
- monthNamesShort: ["Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paz", "Lis", "Gru"],
- dayNamesMin: ["Nie", "Pon", "Wt", "Śr", "Czw", "Pt", "Sob"],
- numberOfMonths: 1,
- constrainInput: true,
- beforeShowDay: nationalDays,
- firstDay: 1
- onSelect: function (selectedDate) {
- if (this.id == 'date_from') {
- var dateMin = $('#date_from').datepicker("getDate");
- var dateMax = $('#date_to').datepicker('getDate');
- var rent_date_from = new Date(dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + 1);
- var rent_date_to = new Date(dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + 29);
- $('#date_to').datepicker("option", "minDate", rent_date_from);
- $('#date_to').datepicker("option", "maxDate", rent_date_to);
- }
- compute();
- }
- });
- $.viewMap_get = {
- '0': $([]),
- 'City1': $('#c1a, #c1b, #c6, #c7'),
- 'City2': $('#c2a, #c2b, #c6, #c7'),
- 'City3': $('#c3a, #c3b, #c6, #c7'),
- 'City4': $('#c4a, #c4b, #c6, #c7'),
- 'City5': $('#c5a, #c5b, #c6, #c7'),
- };
- $.each($.viewMap_get, function () {
- this.hide();
- });
- $('#get_city_district').hide();
- $('#get_car').on('change', function () {
- $.each($.viewMap_get, function () {
- this.hide();
- });
- $('#get_city_district').hide();
- $.viewMap_get[$(this).val()].show();
- $('#get_city_district').show();
- var id = $.viewMap_get[$(this).val()].attr("id");
- $('#' + id).attr('selected', 'selected');
- });
- $.viewMap_return = {
- '0': $([]),
- 'City1': $('#d1a, #d1b, #d7'),
- 'City2': $('#d2a, #d2b, #d7'),
- 'City3': $('#d3a, #d3b, #d7'),
- 'City4': $('#d4a, #d4b, #d7'),
- 'City5': $('#d5a, #d5b, #d7'),
- };
- $.each($.viewMap_return, function () {
- this.hide();
- });
- $('#return_city_district').hide();
- $('#return_car').on('change', function () {
- $.each($.viewMap_return, function () {
- this.hide();
- });
- $('#return_city_district').hide();
- $.viewMap_return[$(this).val()].show();
- $('#return_city_district').show();
- var id = $.viewMap_return[$(this).val()].attr("id");
- $('#' + id).attr('selected', 'selected');
- });
- function compute() {
- var c = $('select#time_from_hour').val();
- var d = $('select#time_from_minute').val();
- var e = $('select#time_to_hour').val();
- var f = $('select#time_to_minute').val();
- var g = $('input#date_from').val();
- var h = $('input#date_to').val();
- var hour1 = g + ' ' + c + ':' + d;
- var hour2 = h + ' ' + e + ':' + f;
- hour1 = hour1.split("/");
- var hour1 = hour1[1] + "," + hour1[0] + "," + hour1[2];
- var timestamp = (new Date(hour1).getTime() / 1000) + 7200;
- $('#total_hour1').val(timestamp);
- hour2 = hour2.split("/");
- var hour2 = hour2[1] + "," + hour2[0] + "," + hour2[2];
- var timestamp = (new Date(hour2).getTime() / 1000) + 7200;
- $('#total_hour2').val(timestamp);
- var x = -$('input#total_hour1').val();
- var y = -$('input#total_hour2').val();
- var total_time = x - y;
- result = total_time / 86400;
- new_number = Math.ceil(result);
- if (isNaN(new_number)) {
- var new_number = 0;
- }
- $('#finish_day').val(new_number);
- if (parseInt($("#finish_day").val()) < 4) {
- $('#return_car').children('#return_car option[value=' + $('#get_car').val() + ']').attr('selected', 'selected').siblings().attr('disabled', true);
- if ($('#return_car').val()) $('#return_car').change();
- } else {
- $('#get_car > option, #return_car > option').prop('disabled', false);
- $('#three_day').hide(2000, function () {
- $(this).remove();
- });
- }
- }
- $('#time_from_hour').change(function () {
- $('#time_to_hour').val($(this).val());
- });
- $('#time_from_minute').change(function () {
- $('#time_to_minute').val($(this).val());
- });
- $('select#time_from_hour').change(compute);
- $('select#time_from_minute').change(compute);
- $('select#time_to_hour').change(compute);
- $('select#time_to_minute').change(compute);
- // $('select#return_car').change(compute);
- $('select#get_car').change(compute);
- $('input#finish_day').change(compute);
- $("#birthday").datepicker({
- changeMonth: true,
- changeYear: true,
- dateFormat: "dd-mm-yy",
- monthNamesShort: ["Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paz", "Lis", "Gru"],
- dayNamesMin: ["Nie", "Pon", "Wt", "Śr", "Czw", "Pt", "Sob"],
- yearRange: '1920:2000',
- firstDay: 1, // Start with Monday
- numberOfMonths: 1
- });
- // konkiguracja wywietlania błędu
- $(".error").mouseover(function () {
- $(this).hide(2000, function () {
- $(this).remove();
- });
- });
- });
The code is called by: