我首先为我的英语道歉,我用谷歌翻译。
我使用联系人表单7,通过其他设置,我希望填写表单后的用户能够访问同一页中包含的div。
各种div通过filterselection被隐藏和激活,我使用这个简单的命令来打开例如id为“mydiv”的div:
<button onclick = "filterSelection ('mydiv')">
这是我用于筛选选择的代码
<script>
filterSelection ("dashboard")
function filterSelection (c) {
var x, i;
x = document.getElementsByClassName ("filterDiv");
if (c == "all") c = "dashboard";
for (i = 0; i <x.length; i ++) {
w3RemoveClass (x [i], "show");
if (x [i] .className.indexOf (c)> -1) w3AddClass (x [i], "show");
}
}
function w3AddClass (element, name) {
var i, arr1, arr2;
arr1 = element.className.split ("");
arr2 = name.split ("");
for (i = 0; i <arr2.length; i ++) {
if (arr1.indexOf (arr2 [i]) == -1) {element.className + = "" + arr2 [i];}
}
}
function w3RemoveClass (element, name) {
var i, arr1, arr2;
arr1 = element.className.split ("");
arr2 = name.split ("");
for (i = 0; i <arr2.length; i ++) {
while (arr1.indexOf (arr2 [i])> -1) {
arr1.splice (arr1.indexOf (arr2 [i]), 1);
}
}
element.className = arr1.join ("");
}
// Add active class to the current button (highlight it)
var btnContainer = document.getElementById ("myBtnContainer");
var btns = btnContainer.getElementsByClassName ("btn");
for (var i = 0; i <btns.length; i ++) {
btns [i] .addEventListener ("click", function () {
var current = document.getElementsByClassName ("active");
current [0] .className = current [0] .className.replace ("active", "");
this.className + = "active";
});
}
</script>
联系人表单7现在允许您通过以下代码段设置其他设置:
document.addEventListener ('wpcf7submit', function (event) {
alert ("Fire!");
}, false);
有人能帮我写正确的代码来打开,例如id为“mydiv”的div,在填写表格并按下inva键之后,为什么我会发疯?
暂无答案!
目前还没有任何答案,快来回答吧!