Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Sunday, 18 September 2011

IE7 & IE8 issues

Hi,
These are some script i founded when try fixed issues with IE7 & IE8:
  1. background-size CSS:
    1. ouisremi - BackgroundSize:
      • Required jQuery 1.7.2
      • Can not integrate with Twitter Bootstrap
      • Perfect for single one
        • https://github.com/louisremi/jquery.backgroundSize.js/blob/master/demo/index.html
    2. aramkocharyan - CSS-Background-Size-jQuery-Plugin:
      • Using javascript get width and height of window size added style elements for img tag
      • Not perfect
        • https://github.com/aramkocharyan/CSS-Background-Size-jQuery-Plugin
  2. rounded-corner:
    1. CSS3 PIE:
      • Can not works well when using menu hover
      • Perfect for static elements
        • http://css3pie.com/
    2. jQuery Corner:
      • Auto added white space for rounded-corner, it's not transparent
      • Perfect for white background
        • http://jquery.malsup.com/corner/
    3. jQuery Curvy Corners:
      • Required jQuery 1.4.2
        • http://code.google.com/p/jquerycurvycorners/downloads/list
        • http://blue-anvil.com/jquerycurvycorners/test.html
      • Latest version is: 1.8.2

Good luck!

Wednesday, 3 August 2011

JavaScript - Convert Vietnamese string to English string

This is function you can use to convert Vietnamese string to English string:


function convertVietnamese(str) {
    str= str.toLowerCase();
    str= str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");
    str= str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");
    str= str.replace(/ì|í|ị|ỉ|ĩ/g,"i");
    str= str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");
    str= str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");
    str= str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");
    str= str.replace(/đ/g,"d");
    str= str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g,"-");
    str= str.replace(/-+-/g,"-");
    str= str.replace(/^\-+|\-+$/g,"");

    return str;
}


Good luck!