Javascript calendar display works fine in IE7 & FF, but not in Opera.

5 pts.
Tags:
Calendar
firefox
IE7
JavaScript
Opera
Web development
I've been working with a calendar I found here that works well in Firefox & IE, but in Opera it stops filling in days when it gets to whatever today's date is. I'm not a javascript expert, but I was wondering if there is anything obvious I could do to get it working properly in Opera. I've cleaned up a number of minor/obvious things and have a better-looking slimmed-down one ... but that Opera thing seems strange. Thanks for any help.

Answer Wiki

Thanks. We'll let you know when a new response is added.

This only took a couple of min. to track down, so ignore the other members’ non-answers. They shouldn’t get points for that.

There seems to be a bug in Opera (might be fixed in 9.5) when using the Date constructor with 0:

<pre>var lastDate = new Date(String(monthNum+1)+”/0/”+String(yearNum));</pre>

In FF and IE this sets the date to the last day of the month, but in Opera it set the date to the next day, which is why it stops iteration after 2.

It looks like you can fix this by replacing the instances of the above statement with this:

<pre>var lastDate = new Date(String(monthNum+1)+”/1/”+String(yearNum));
lastDate.setDate(0);</pre>

Apparently the setDate method in Opera works fine with 0.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Buddyfarr
    Mrdenny is correct. The software writer states that it is compatible with IE and Firefox. It doesn't say anything about Opera. Even though java is supposed to be cross-platform independant that doesn't mean that the writer made it that way. You would have to recode it yourself or talk with the original software developer to see if they will test it in opera and fix it.
    6,850 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following