Excel VBA单击Javascript弹出确定按钮

时间:2017-03-09 19:41:47

标签: javascript excel vba popup

<input tabindex="1" title="Remove" class="button rsetButtonSmall mutexElement has-button-registered-callback" id="delete0" onclick="javascript:if(uiMethods.buttons.interceptClick.verifyClick(this)){uiMethods.removeItem('13822120', '', 'Are you sure you want to remove the selected saved filing?', deleteFiling, uiMethods.buttons.mutex.enableAll);}else{return false;}" type="button" value="Remove">

我需要点击&#34;删除&#34;按钮。但点击后,有一个JS弹出窗口询问我是否确定。我需要单击“确定”按钮或绕过它。怎么样? 我尝试了这个VBA代码但是点击什么也没做,即使手动点击它也会使按钮无响应。

Set el = IE.document.getElementById("delete0")
el.onclick = ""
el.click

el.onclick是

function onclick(event)
{
javascript:if(uiMethods.buttons.interceptClick.verifyClick(this)) {uiMethods.removeItem('13822120', '', 'Are you sure you want to remove the selected saved filing?', deleteFiling, uiMethods.buttons.mutex.enableAll);}else{return false;}
}

1 个答案:

答案 0 :(得分:0)

<div id="div1">Test div delete</div>
<button id="btnDelete">Delete</button>
<script type="text/javascript"> 
document.getElementById('btnDelete').onclick = function(){
    var conVal = confirm("Do Yoy Want to delete");
    if(conVal===true){
        var div1 = document.getElementById('div1');
        document.body.removeChild(div1);
    } else {
        alert("you click cancel");
    }
}
</script>