function changeURLPar(destiny, par, par_value)
{
var pattern = par+'=([^&]*)';
var replaceText = par+'='+par_value;
if (destiny.match(pattern))
{
var tmp = '/\\'+par+'=[^&]*/';
tmp = destiny.replace(eval_r(tmp), replaceText);
return (tmp);
}
else
{
if (destiny.match('[\?]'))
{
return destiny+'&'+ replaceText;
}
else
{
return destiny+'?1=1&'+replaceText;
}
}
return destiny+'\n'+par+'\n'+par_value;
}
用JS动态改变地址栏内容 window.location.href window.location.hash
用window.location.hash 可以改变地址栏内容,而不用像改变wndow.location.href那样会提交。
改变hash后,地址栏后会加上#,,,,,这样子。这样可以解决AJAX无刷新状态下的页面所处的位置,也可以完成某些无刷新状态下的界面特效,好好利用前途无量。不错的东东