posts - 82, comments - 269, trackbacks - 0, articles - 1
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

用JS从URL中取回参数

Posted on 2007-11-06 08:39 itspy 阅读(248) 评论(0)  编辑  收藏

function gup( name ){ 
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
var regexS = "[\\?&]"+name+"=([^&#]*)"; 
var regex = new RegExp( regexS ); 
var results = regex.exec( window.location.href ); 
if( results == null )    return "";  else    return results[1];
}


var frank_param = gup( 'frank' );

alert(frank_param);


只有注册用户登录后才能发表评论。


网站导航: