confirm() event.target.getAttribute('id')
w
<?php $wecho = '<form id="del' . $wid . '" method="POST" action="" > <input type="hidden" name="del" value="' . $one[$wii . 's' . 'id'] . '" > <span id="js' . $wid . '" onclick="w_js_confirm()" >×</span></form>'; echo $wecho; ?> <script> function w_js_confirm() { var even_ttarget_getAttributeID = event.target.getAttribute('id') var form_id = even_ttarget_getAttributeID.replace(/js/, 'del') console.log(form_id) var wr = confirm('您确定删除该预订信息?'); console.log(wr); if (wr == true) { document.getElementById(form_id).submit(); } } </script>