日期:2014-05-16  浏览次数:20310 次

页面js样式
/**解决iframe自适应高度问题1*/
function SetCwinHeight()
{
var cwin=document.getElementById("cwin");

if (document.getElementById)
{
//if (cwin && !window.opera)
//{
if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
cwin.height = cwin.contentDocument.body.offsetHeight;
if(cwin.Document && cwin.Document.body.scrollHeight)
cwin.height = cwin.Document.body.scrollHeight;
//}
}
}

/**解决iframe自适应高度问题2*/
function SetIframeHeight(iName)
{
var ifr=document.getElementById(iName);

if (document.getElementById)
{
//if (ifr && !window.opera)
//{
if (ifr.contentDocument && ifr.contentDocument.body.offsetHeight){
ifr.height = ifr.contentDocument.body.offsetHeight;
}
if(ifr.Document && ifr.Document.body.scrollHeight){
ifr.height = ifr.Document.body.scrollHeight;
}

//}
}
}


// 读取cookie
function getCookies(name)
{
var strCookie=document.cookie;
var arrCookie=strCookie.split(";");
var rtl = "";
for(var i=0;i<arrCookie.length;i++){

    var arr=arrCookie[i].split("=");
    var a = arr[0].replace(/(^\s*)|(\s*$)/g, "");
    if(a==name)
    {
    return arr[1];
    }
   
   
}
return "";
}

// 删除cookie
function deleteCookie(name){
var exp = new Date();
exp.setTime (exp.getTime() - 10000);
var cval = getCookies(name);
document.cookie = name+"="+cval+"suPwd=;expires="+exp.toGMTString();
}

//计算中英文字符个数
   //function countCharacters(str){
    //var totalCount = 0; 
    //for (var i=0; i<str.length; i++) { 
    //    var c = str.charCodeAt(i); 
    //if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) { 
    //       totalCount++; 
    //    }else {    
    //        totalCount+=3; 
    //    } 
    //}
    //return totalCount;
//}

function countCharacters(str){
    return str.length;
}