Jscalendar 1.0 displays Chinese characters. The location in IE7 is incorrect. It is applied in mojoportal.

Source: Internet
Author: User
Jscalendar-1.0 Chinese Solution

(1) jscalendar-1.0 does not support Chinese
Is because there is no setup for the weekly start date modification method is to add the calendar. _ FD = 0 in the file calendar-cn_utf8.js (or cn_utf8.js, calendar-zh.js) in the Lang directory;
Code The snippets are as follows: // Short day names
Calendar. _ SDN =   New Array
( " \ U5468 \ u65e5 " ,
  " \ U5468 \ u4e00 " ,
  " \ U5468 \ u4e8c " ,
  " \ U5468 \ u4e09 " ,
  " \ U5468 \ u56db " ,
  " \ U5468 \ u4e94 " ,
  " \ U5468 \ u516d " ,
  " \ U5468 \ u65e5 " );

Calendar. _ FD =   0 ; // Added this line

// Full month names
Calendar. _ Mn =   New Array
( " \ U4e00 \ u6708 " ,
  " \ U4e8c \ u6708 " ,
  " \ U4e09 \ u6708 " ,
  " \ U56db \ u6708 " ,
  " \ U4e94 \ u6708 " ,
  " \ U516d \ u6708 " ,
  " \ U4e03 \ u6708 " ,
  " \ U516b \ u6708 " ,
  " \ U4e5d \ u6708 " ,
  " \ U5341 \ u6708 " ,
  " \ U5341 \ u4e00 \ u6708 " ,
  " \ U5341 \ u4e8c \ u6708 " );

The <link href = "CSS file" type = "text/CSS" must be added to the page that uses the control"Rel = "stylesheet"/>

Assume that the encoding rule for Web applications is UTF-8, garbled characters will occur in the JS file if there are any Chinese characters (it may be that other pages are abnormal)To solve this problem, add charset = "gb2312" or charset = "big5" to the Javascript reference" 

Example: <SCRIPT type = "text/JavaScript" Language = "JavaScript" src = "scripts/function. js" charset = "gb2312"> </SCRIPT>

(2)Fixed a bug when displaying calendar on IE7
Added to line90Of calendar. js
Calendar. is_ie7 = (calendar. is_ie &/MSIE 7 \. 0/I. Test (navigator. useragent ));

Added to line1396OfCalendar. js

If (calendar. is_ie7 ){
BR. Y + = Window. scrolly;
BR. x + = Window. scrollx;
}
Else if (calendar. is_ie ){
BR. Y + = Document. Body. scrolltop;
BR. x + = Document. Body. scrollleft;
}
Else {
BR. Y + = Window. scrolly;
BR. x + = Window. scrollx;
}

Look like this: VaR CP = Document. createelement ( " Div " );
VaR S = CP. style;
S. Position =   " Absolute " ;
S. Right = S. Bottom = S. Width = S. Height =   " 0px " ;
Document. Body. appendchild (CP );
VaR BR = Calendar. getabsolutepos (CP );
Document. Body. removechild (CP );
If (Calendar. is_ie7) {//Added begin
BR. Y+ =Window. scrolly;
BR. x+ =Window. scrollx;
}
Else   If (Calendar. is_ie) {
BR. Y+ =Document. Body. scrolltop;
BR. x+ =Document. Body. scrollleft;
}
Else   {
BR. Y+ =Window. scrolly;
BR. x+ =Window. scrollx;
} // Added end
// If (calendar. is_ie ){
// BR. Y + = Document. Body. scrolltop;
// BR. x + = Document. Body. scrollleft;
// } Else {
// BR. Y + = Window. scrolly;
// BR. x + = Window. scrollx;
// }
VaR TMP = Box. x + Box. Width - BR. X;
If (TMP >   0 ) Box. x -= TMP;
TMP = Box. Y + Box. Height - BR. Y;
If (TMP >   0 ) Box. Y -= TMP;

(3) For mojoportal datepicker:
In addition to modifying the pieces of calendar-cn_utf8.js (or cn_utf8.js, calendar-zh.js) plus calendar. _ FD = 0;
Modify Calendar. js
Make the following changes:
Add charset = \ "gb2312 \" to \ mojoportal. Web. Controls \ jscalendardatepicker. CS \"
Private   Void Setupscripts ()
{
This . Page. clientscript. registerclientscriptblock ( This . GetType (), " Jscalendarmain " , " <SCRIPT type = \ " Text / Javascript \ " Src = \ ""  
+ Resolveurl ( This . Scriptdirectory +   " /Calendar. js " ) +   " \ " > </ Script > " );

This . Page. clientscript. registerclientscriptblock ( This . GetType (), " Jscalendarculture " , " <SCRIPT type = \ " Text / Javascript \ " Src = \ ""
+ Resolveurl ( This . Scriptdirectory +   " / "   +   This . Languagefile) +   " \ " Charset = \ " Gb2312 \ " > </ Script > " ); // Aimin

This . Page. clientscript. registerclientscriptblock ( This . GetType (), " Jscalendarsetup " , " <SCRIPT type = \ " Text / Javascript \ " Src = \ ""  
+ Resolveurl ( This . Scriptdirectory +   " Calendar-setup.js " ) +   " \ " > </ Script > " );

Ref:
http://www.dynarch.com/forums/1993
http://hi.baidu.com/ksir/blog/item/632a2d8169efc5dbbd3e1e1b.html
http://www.cnblogs.com/haojinguo/archive/2007/12/30/696579.html
http://javajiao.javaeye.com/blog/184014

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.