网页的Diable/Prevent Java功能 [英] Diable/Prevent Java Function of webpage

查看:82
本文介绍了网页的Diable/Prevent Java功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好团队,

我已经在Excel VBA中开发了一个Crawler,但遇到了一个问题.
我导航到一个URL,但是-在该网页脚本上是

Hello Team,

I have developing one Crawler in Excel VBA but facing one issue.
I am navigating to one URL but - On that webpage script is

<script language="JavaScript" type="text/javascript">function printpage()    {  window.focus();  window.print() ;   }</script>



但是我不希望有这个打印对话框"窗口,由于这个原因,我对页面的控制丢失了,直到我关闭/确定该打印对话框"为止.
有什么办法-
-禁用/防止使用此JavaFunction(因此打印"窗口不会一个-问题将会解决)
-以编程方式关闭此窗口(不使用Windows处理程序-FindWindow并关闭等)

您的帮助非常有用.!!!



But I don''t want this Print Dialog Window, Due to this my control over page lost until I close/ok this Print Dialog

Is there any way -
- To Disable/Prevent this JavaFunction (So Print window will not one - Problem will solve)
- Programatically close this window (Without using windows handler - FindWindow and close, etc)

Your help is very much appriciated.!!!

推荐答案

显然,没有禁用"或阻止"功能之类的东西.

如果您阅读了我对问题的评论,则可能会得到提示.不仅没有这样的概念,而且您实际上并不需要禁用"或阻止"任何东西,否则您将不会编写该函数.我可以看到的唯一感觉是:您可能希望根据某些条件调用或不调用某些事件处理程序,对吗?即使您可以这样做,原则上,出于多种原因,您也不建议您这样做.您真正希望使用的功能是检查其实现中的某些条件.换句话说,printpage中的第一条语句可能类似于if (!canPrint()) return;之类的东西.函数canPrint()应该做什么?根据您未与我们分享的逻辑,返回真或假;自己想想.

此外,您应该考虑触发事件处理程序,该处理程序最终将调用您printpage方法.您应该自己知道在什么事件上应该启用/禁用控件(例如按钮),以及在什么条件下自己决定.我将仅展示如何启用或禁用.看这里:
http://forums.asp.net/t/1154226.aspx/1 [ ^ ].

—SA
Apparently, there is no such thing as "disable" or "prevent" a function.

If you read my comment to the question, you may get the hint. Not only there is no such concepts, you don''t really need to "disable" or "prevent" anything, otherwise you would not write the function. The only sense I can see it this: you might want some event handler to be or not to be invoked depending on some condition, right? Even though you could do it, in principle, you would not recommend doing it, by a number of reasons. What you really would prefer is having you function to check some condition inside its implementation. In other words, first statement inside printpage could be something like if (!canPrint()) return; or something like that. What should the function canPrint() do? Return true or false according to you logic which you did not share with us; think about it by yourself.

Additionally, you should think about triggering of the event handlers which eventually call you printpage method. You should know by yourself on what event should you enable/disable a control (for example, a button) and on what condition, decide it by yourself. I''ll just show how do enable or disable. Look here:
http://forums.asp.net/t/1154226.aspx/1[^].

—SA


这篇关于网页的Diable/Prevent Java功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆