```javascript(?|&)(改写|长尾词)=([^&]+)```

2026-03-30 08:261阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计238个文字,预计阅读时间需要1分钟。

```javascript/(\?|&)(改写|长尾词)=([^&]+)/```

示例:使用JavaScript传递参数(多个)创建URL,不使用多余字符,不超过100字。javascriptvar url=B.aspx?txtA= + document.getElementById(txtName).value + &txtB= + document.getElementById(txtAge).value;window.open(url, 'xWindow', 'width=640,height=400,status=no,toolbar=no,menubar=no');

```javascript/(\?|&)(改写|长尾词)=([^&]+)/```

例子:
//javascript传参数(多个)
var url = "B.aspx?txtA="+document.getElementById("txtName").value;
url +="&txtB="+document.getElementById("txtAge").value;
window.open(url,'xWindow','width=640,height=400,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=250,left=430');
//B.aspx目标页取得
复制代码 代码如下:
<scirpt language='javascirpt'>
<!--
function GetStringValue()
{
String.prototype.getQueryString = function(name)//name 是URL的参数名字
{
var reg = new RegExp("(^|&|\\?)"+ name +"=([^&]*)(&|$)"), r;
if (r=this.match(reg)) return unescape(r[2]); return null;
};
//直接可以传参数名 就可以 得到参数的值
alert(window.location.href.getQueryString("txtA")+window.location.href.getQueryString("txtB"));
}
-->
</scirpt>

window.open和 window.location区别:
window.open是打开新窗口
window.location是将本页替换了,也就是定位
onclick="javascript:window.location.href='XXXX.aspx';"
JavaScript URL参数读取改进版
www.jb51.net/article/17116.htm

本文共计238个文字,预计阅读时间需要1分钟。

```javascript/(\?|&)(改写|长尾词)=([^&]+)/```

示例:使用JavaScript传递参数(多个)创建URL,不使用多余字符,不超过100字。javascriptvar url=B.aspx?txtA= + document.getElementById(txtName).value + &txtB= + document.getElementById(txtAge).value;window.open(url, 'xWindow', 'width=640,height=400,status=no,toolbar=no,menubar=no');

```javascript/(\?|&)(改写|长尾词)=([^&]+)/```

例子:
//javascript传参数(多个)
var url = "B.aspx?txtA="+document.getElementById("txtName").value;
url +="&txtB="+document.getElementById("txtAge").value;
window.open(url,'xWindow','width=640,height=400,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=250,left=430');
//B.aspx目标页取得
复制代码 代码如下:
<scirpt language='javascirpt'>
<!--
function GetStringValue()
{
String.prototype.getQueryString = function(name)//name 是URL的参数名字
{
var reg = new RegExp("(^|&|\\?)"+ name +"=([^&]*)(&|$)"), r;
if (r=this.match(reg)) return unescape(r[2]); return null;
};
//直接可以传参数名 就可以 得到参数的值
alert(window.location.href.getQueryString("txtA")+window.location.href.getQueryString("txtB"));
}
-->
</scirpt>

window.open和 window.location区别:
window.open是打开新窗口
window.location是将本页替换了,也就是定位
onclick="javascript:window.location.href='XXXX.aspx';"
JavaScript URL参数读取改进版
www.jb51.net/article/17116.htm