現(xiàn)在,我有一張卡片供人們添加、編輯或刪除設(shè)備,隨后帶有 FAS 字體很棒的圖標(biāo)?;旧希蚁胫廊绾螢槟橙藛螕暨@些圖標(biāo)之一創(chuàng)建彈出命令或選項(xiàng)。例如,如果有人要單擊“刪除”符號(hào),則會(huì)彈出一個(gè)包含文本、是和無按鈕的彈出窗口。我被卡住的地方是嘗試使用 yes 和 no 按鈕關(guān)閉模態(tài),以及如何為 yes 命令提交信息。另外,我正在嘗試更改按鈕的樣式(邊框、背景顏色)并被卡住。目前,我的代碼示例可以訪問 w3schools.com-- https://www.w3schools.com/code/tryit.asp?filename=G77OAKK28TTH// Get the modalvar modal = document.getElementById("myModal");// Get the button that opens the modalvar btn = document.getElementById("myBtn");// Get the <span> element that closes the modalvar span = document.getElementsByClassName("close")[0];// When the user clicks the button, open the modal btn.onclick = function() { modal.style.display = "block";}// When the user clicks on <span> (x), close the modalspan.onclick = function() { modal.style.display = "none";}// When the user clicks anywhere outside of the modal, close itwindow.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; }}body { font-family: Arial, Helvetica, sans-serif;}/* The Modal (background) */.modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ padding-top: 100px; /* Location of the box */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0, 0, 0); /* Fallback color */ background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */}/* Modal Content */.modal-content { background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888; width: 80%;}/* The Close Button */.close { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold;}.close:hover,.close:focus { color: #000; text-decoration: none; cursor: pointer;}
使用是/否命令為網(wǎng)絡(luò)創(chuàng)建模態(tài)
尚方寶劍之說
2021-09-17 12:46:03