你好再次堆栈的人从函数变量到window.location.href'未定义'
我有我的代码小问题。 我想发送我的变量与window.location.href
,但我不断收到错误not defined
。
这是函数,它会选择我的图像(src)和id(chosenid) chosenid的确如我测试过的那样工作。
function HeadShow() {
var HeadItems = document.getElementById('HeadItems');
HeadItems.style.display = 'block';
}
function headHide(src, chosenid) {
var head = document.getElementById("head");
var HeadItems = document.getElementById('HeadItems');
HeadItems.style.display = 'none';
head.innerHTML = "<img src='" + src + "' width=80; height=80;>";
var chosenhead = chosenid;
}
然后,我也有应变量发送到下一个页面中的功能:
function send() {
window.location.href = "test3.php?head=" + chosenhead;
}
我得到的是错误:chosenhead is not defined
希望你们能帮助我有了这个。
尝试过,但现在它在window.location的 – user3249657
没有等到我的坏发送一个空的变量。我犯了一个错字。感谢你的回答 – user3249657