gpt4 book ai didi

javascript - 如何使用 vbscript 触发 javascript 函数?

转载 作者:行者123 更新时间:2023-12-03 00:14:05 24 4
gpt4 key购买 nike

我正在尝试使用 vbscript 单击“打印”按钮。然而,它实际上并没有触发适当的事件。所以现在我想我需要找到一种方法来调用函数本身。

这是按钮代码:

<input name="ucDetailsAJ1670783$btnPrint" tabindex="-1" class="rbDecorated rbPrimary" id="ucDetailsAJ1670783_btnPrint_input" style="width: 100%; padding-right: 4px; padding-left: 0px;" type="submit" value="Print">

<input name="ucDetailsAJ1670783_btnPrint_ClientState" id="ucDetailsAJ1670783_btnPrint_ClientState" type="hidden" value='{"text":"Print","value":"","checked":false,"target":"","navigateUrl":"","commandName":"","commandArgument":"","autoPostBack":false,"selectedToggleStateIndex":0,"validationGroup":null,"readOnly":false,"primary":false,"enabled":true}' autocomplete="off">

这是打印功能代码:

function btnPrint_OnClientClicking(sender, args)
{

doPrint();


return false;
}

function openPopup()
{
var url = document.location.origin + '/Customized/CustomizedControls/DEAModules/Search/PrintDetails.aspx?RelId=605598&Key=29_117_8_167_19_163_12_121_129_12_163_128_60_154_31_198_70_205_6_230_173_133_82_216_52_56_178_209_108_67_255_205';
var win = window.open(url, '_blank');
if (win) win.focus();
}

function doPrint()
{
var divButtons = document.getElementById('ucDetailsAJ1670783_divButtons');
if (divButtons) { divButtons.style.display = 'none'; }

setTimeout("window.print();", 300);

}

这是我的代码和我收到的错误消息(使用 vbscript 调用 javascript 函数)我知道我错过了一些东西:

Null error message

objIE.Document.parentWindow.execScript "doPrint();", "javascript"

Expected statement

objIE.Document.parentWindow.execScript "doPrint();", "jscript"

Unterminated string constant

objIE.document.parentWindow.execScript "btnPrint_OnClientClicking(sender, args);", "javascript"

Expected statement

objIE.document.parentWindow.execScript "btnPrint_OnClientClicking();", "javascript"

最佳答案

您可能遇到了 Internet Explorer 11 中的更改

From MSHTML Reference - execScript method

[IHTMLWindow2::execScript is no longer supported. Starting with Internet Explorer 11, use eval. For info, see Compatibility changes.]

关于javascript - 如何使用 vbscript 触发 javascript 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54595077/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com