惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 热门话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
C
Cisco Blogs
A
Arctic Wolf
月光博客
月光博客
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
量子位
小众软件
小众软件
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
N
Netflix TechBlog - Medium
K
Kaspersky official blog
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Y
Y Combinator Blog
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
S
Schneier on Security
D
Docker
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
GbyAI
GbyAI
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
H
Help Net Security
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tenable Blog
B
Blog
Know Your Adversary
Know Your Adversary
IT之家
IT之家

博客园 - 散步的蠕虫

[整理收藏]CSS Hack IE6,IE7,IE8 and Firefox 【转载】Javascript标准DOM Range操作 [收藏]winform拖动方法 [收藏]SQL SERVER2005自动备份 [更新+源码]一个随时随地随便记的超轻量级的记事本软件WheneverNote V1.0.9.218 [发布+源码]一个随时随地随便记的超轻量级的记事本软件WheneverNote V1.0.9.215 [总结]Server Application Error(IIS5 HTTP500)内部错误分析及解决办法 [转载]XML和HTML常用转义字符 C# TO Excel 新概念III WCF - Message Security with Mutual Certificates WCF - Common Security Scenarios 【转载】LINQ to SQL (Part 5 - Binding UI using the ASP:LinqDataSource Control) 【转载】LINQ to SQL (Part 4 - Updating our Database) 【转载】LINQ to SQL (Part 3 - Querying our Database) 【转载】LINQ to SQL (Part 2 - Defining our Data Model Classes) 【转载】Using LINQ to SQL (Part 1) 常用开发辅助工具清单 Local Resource应用概述
JavaScript 实用方法库
散步的蠕虫 · 2008-01-28 · via 博客园 - 散步的蠕虫

/*
/* JavaScript Document
*/


/* Calculate the length of character string */
String.prototype.len
=function()
{
    
return this.replace(/[^x00-xff]/g, "**").length;
}


/* Take out the blank both on left and right */
String.prototype.trim
=function()
{
    
return this.replace(/(^[\s+| +])|([\s+| +]$)/g,"");
}


/* Take out the left blank */
String.prototype.ltrim 
= function()
{
    
return this.replace(/(^[\s+| +])/g, "");
}


/* Take out the right blank */
String.prototype.rtrim 
= function()
{
    
return this.replace(/([\s+| +]$)/g, "");
}


/* Take out left and right blank and replace multi-blank by one blank */
String.prototype.atrim 
= function() 

    
return this.replace(/(^[\s+| +])|([\s+| +]$)/g,"").replace(/\s+| +/g," ");
}

    
/* Getting the version of browser 1-IE, 2-Firefox */ 
function getOs()
{
    
if(navigator.userAgent.indexOf("MSIE")>0)return 1;
    
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;
    
return 0;
}

function RedirectLanguage(language)
        
{
            
var urlValue=window.location.href;
            
var returnURL=urlValue;
            
var indexOfQuestionMark=urlValue.indexOf("?");
            
if(indexOfQuestionMark>0)
            
{
                
var arrayUrl=urlValue.split('?');
                
var arrayParameter=arrayUrl[1].split('&');
                
var indexOfLang=arrayParameter[0].indexOf("Lang");
                
if(indexOfLang==0)
                
{
                    returnURL
=urlValue.replace(arrayParameter[0],"Lang="+language);
                }

                
else
                
{
                    returnURL
=arrayUrl[0]+"?Lang="+language+"&"+arrayUrl[1];
                }

            }

            
else
            
{
                returnURL
=urlValue.replace(/(\/+$)/g, "")+"?Lang="+language;
            }

            window.location.href
=returnURL; 
        }


posted on 2008-01-28 14:56  散步的蠕虫  阅读(231)  评论(0)    收藏  举报