0
<div id="cp_opening_hours">
<h3 class="howtoreach openinghrs">Opening Hours</h3>
<span>Monday: 10.30 AM - 9.30 PM<br></span>
<span>Tuesday: 10.30 AM - 9.30 PM<br></span>
<span>Wednesday: 10.30 AM - 9.30 PM<br></span>
<span>Thursday: 10.30 AM - 9.30 PM<br></span>
<span>Friday: 10.30 AM - 9.30 PM<br></span>
<span>Saturday: 10.30 AM - 9.30 PM<br></span>
<span>Sunday: 10.30 AM - 9.30 PM<br></span></div>
....顯示日期和時間
var dayNames = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var nData = new Date();
jQuery("#cp_opening_hours span").each(function(i) {
var to_day=jQuery(this).text();
to_day_new=to_day.split(" ");
to_day_new1=to_day_new[0].split(':');
span_pos=dayNames.lastIndexOf(dayNames[nData.getDay()]);
span_val=jQuery("#cp_opening_hours span:nth-of-type("+span_pos+")").text();
if(span_val!=undefined){jQuery("#thelanguage_new").append('<span>'+span_val+'</span>');}
jQuery("#cp_opening_hours span:nth-of-type("+span_pos+")").remove();
if(to_day_new1[0]=='Sunday')
{
jQuery(this).remove();
to_day_new_time=to_day.split(':');
main_today_time=to_day_new_time[1];
if(main_today_time=="Closed")
{
jQuery('#cp_opening_hours div').prepend('<span class="closed">Today: '+main_today_time+'<br/></span>');
}
else
{
jQuery('#cp_opening_hours div').prepend('<span class="open">Open Today: '+main_today_time+'<br/></span>');
}
}
});
jQuery("#thelanguage_new p:nth-of-type(1)").remove();
我想告訴今天基地的日期和時間,如果今天是星期三。所以我想這樣的
<div id="cp_opening_hours">
<h3 class="howtoreach openinghrs">Opening Hours</h3>
<span>Open Today: 10.30 AM - 9.30 PM<br></span>
<span>Thursday: 10.30 AM - 9.30 PM<br></span>
<span>Friday: 10.30 AM - 9.30 PM<br></span>
<span>Saturday: 10.30 AM - 9.30 PM<br></span>
<span>Sunday: 10.30 AM - 9.30 PM<br></span>
<span>Monday: 10.30 AM - 9.30 PM<br></span>
<span>Tuesday: 10.30 AM - 9.30 PM<br></span></div>
非常感謝你 – user3405206
不客氣。如果有用,你可以[接受答案](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) – mplungjan