我一直在尝试让脚本在我的网站上运行,它适用于 Chrome、Safari 和 Firefox,但不适用于 IE 9(它将在兼容模式下运行)或 Opera。有没有我没有发现的问题?
这是脚本:
$(document).ready(function(){
$.getJSON('/storage/xml/biblereading2.json', function(data) {
today = Date.today();
var name = today.getDay();
var date = today.getDate();
var month = today.getMonth();
var year = today.getFullYear();
var fullday = name.toString();
var todaydoy = today.getDayOfYear();
var todaywoy = today.getWeekOfYear();
//array for months
fullmonth = new Array (12);
fullmonth[0] = "January";
fullmonth[1] = "February";
fullmonth[2] = "March";
fullmonth[3] = "April";
fullmonth[4] = "May";
fullmonth[5] = "June";
fullmonth[6] = "July";
fullmonth[7] = "August";
fullmonth[8] = "September";
fullmonth[9] = "October";
fullmonth[10] = "November";
fullmonth[11] = "December";
fullday = new Array (7);
fullday[0] = "Sunday";
fullday[1] = "Monday";
fullday[2] = "Tuesday";
fullday[3] = "Wednesday";
fullday[4] = "Thursday";
fullday[5] = "Friday";
fullday[6] = "Saturday";
var s = todaydoy - 1;
$("#biblereading").append('<p><span class="bold_font">Bible Reading for Today:</span> </br>' + fullmonth[month] + ' ' + date + ', ' + year + '</br>' + data.schedule[s].portion.reading + '</br></p>');
});
});
我正在使用 date.js 来处理前几个变量中的日期问题,一个数组来给出拼写出来的月份和日期,并且我正在从同一服务器调用一个 json。
Opera 一直告诉我我在 data.schedule[s] 处有一个 TypeError
并且 IE 9 一直告诉我我在 data.schedule[s] 中有一个未定义或空值。
有任何想法吗?(您可以在首页上看到实施http://rosemontbaptist.com的这种尝试。