Php 使用javascript在页面URL中添加多个变量
因为我对php和javascript的使用还比较陌生,所以在尝试在URL中添加多个变量时遇到了这个问题 我使用以下脚本:Php 使用javascript在页面URL中添加多个变量,php,javascript,url,variables,Php,Javascript,Url,Variables,因为我对php和javascript的使用还比较陌生,所以在尝试在URL中添加多个变量时遇到了这个问题 我使用以下脚本: <script> function refresh() { var PCWDE = document.getElementById("PC"); var NMWDE = document.getElementById("naam"); var VNMWDE = document.getElementById("voornaam"); var ONDWDE
<script>
function refresh() {
var PCWDE = document.getElementById("PC");
var NMWDE = document.getElementById("naam");
var VNMWDE = document.getElementById("voornaam");
var ONDWDE = document.getElementById("onderneming");
var BTWWDE = document.getElementById("btwnummer");
var LNDWDE = document.getElementById("land");
this.document.location.href = "http://example.com/form.php?PCS=" + PCWDE.value "&nm=" + NMWDE.value "&vnm=" + VNMWDE.value "&ond=" + ONDWDE.value "&btw=" + BTWWDE.value "&lnd=" + LNDWDE.value;
}
</script>
否则就不行了。“onblur”事件无法工作,或者脚本无法运行
有没有一种方法可以像我现在做的那样将多个变量添加到URL中?您忘记了加号。这是一个语法错误,如果打开错误控制台,应该会看到错误消息。(在firefox上按control-shift-j) 应该是:
this.document.location.href = "http://example.com/form.php?PCS=" + PCWDE.value + "&nm=" + NMWDE.value + "&vnm=" + VNMWDE.value + "&ond=" + ONDWDE.value + "&btw=" + BTWWDE.value + "&lnd=" + LNDWDE.value;
this.document.location.href = "http://example.com/form.php?PCS=" + PCWDE.value;
this.document.location.href = "http://example.com/form.php?PCS=" + PCWDE.value + "&nm=" + NMWDE.value + "&vnm=" + VNMWDE.value + "&ond=" + ONDWDE.value + "&btw=" + BTWWDE.value + "&lnd=" + LNDWDE.value;