Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么在我的JS弹出窗口中,我的html表单没有';不行?_Javascript_Html - Fatal编程技术网

Javascript 为什么在我的JS弹出窗口中,我的html表单没有';不行?

Javascript 为什么在我的JS弹出窗口中,我的html表单没有';不行?,javascript,html,Javascript,Html,我做了一个弹出窗口,上面写着“你确定要删除该类别吗?”如果他们说是,执行一个表单,但这个表单不起作用 html代码: var modal=document.getElementById(“弹出”); var btns=Array.prototype.slice.call(document.queryselectoral(“.remove\u openpopup”); var span=document.getElementsByClassName(“关闭按钮”)[0]; btns.forEac

我做了一个弹出窗口,上面写着“你确定要删除该类别吗?”如果他们说是,执行一个表单,但这个表单不起作用

html代码:

var modal=document.getElementById(“弹出”);
var btns=Array.prototype.slice.call(document.queryselectoral(“.remove\u openpopup”);
var span=document.getElementsByClassName(“关闭按钮”)[0];
btns.forEach(功能(btn){
btn.onclick=函数(){
modal.style.display=“块”;
}
});
span.onclick=函数(){
modal.style.display=“无”;
}
span2.onclick=函数(){
modal.style.display=“无”;
}
window.onclick=函数(事件){
如果(event.target==模态){
modal.style.display=“无”;
}
}

&时代;
您确定不删除此类别吗

不 对
您正在使用getElementByClassName,但它不存在。最接近的是GetElementsByCassName,它返回一个具有请求类名的元素数组,但在这种情况下,我认为应该使用getElementById并将id属性设置为表单:

<body>
    <a href="#" class="remove_openpopup">remove</a>
    <a href="#" class="remove_openpopup">remove2</a>
    <a href="#" class="remove_openpopup">remove3</a>

    <div id="popup" class="popup">
      <div class="popup_content">
        <span class="close">&times;</span>
        <p>Are you sure you wan't delete this categorie ?</p>
        <button class="button_popup close_button">No</button>
        <button class="button_popup close_button" onclick='document.getElementById("remove").submit()'>Yes</button>
      </div>
    </div>
    <form id="remove" method="post"><input type="hidden" name="remove" /></form>
</body>

&时代;
您确定不删除此类别吗

不 对
什么也没发生?JavaScript控制台中没有出现错误,说
document.getElementByClassName
不是函数吗?调试JS时控制台是打开的,不是吗?