JScript simulation of the inputBox function of VBA

Source: Internet
Author: User
Key points of this article: example WScript. CreateObject event prefix binding event processing example InternetExplorer. Application in JScript, it imitates the inputBox function example JScript host's method of accessing the page content and script during runtime. It is estimated that this article is doomed to be copied as soon as it is published, marking the source address: * Tips: ana


Key points of this article:

  1. Event prefix binding process for example WScript. CreateObject
  2. Example: InternetExplorer. Application imitates the inputBox function in JScript
  3. Example: how to access the page content and script when the JScript host is running.

It is estimated that this article is destined to be the fate of the copy, marking the source address: http://blog.csdn.net/winsenjiansbomber/article/details/41338243

/* Tips: an alert emulator for Wscript host */function alert(msg){    WScript.Echo(msg+"");}// Binding event handler prefix: ONIE_var IE = WScript.CreateObject("InternetExplorer.Application","ONIE_");IE.left=50;IE.top = 100;IE.height = 200;IE.width = 350;IE.menubar = false;IE.toolbar = false;IE.statusbar = false;IE.resizable = false;IE.navigate("c:\\temp\\readme.html");IE.visible = true;while(!IE.Document.Script.GetValue){ // break when page load and run    WScript.Sleep( 300 );}alert("Please click OK");//alert(IE.Document.Script);//alert(IE.Document.body);//alert(IE.Document.Script.GetValue);alert("GetValue()="+IE.Document.Script.GetValue());WScript.DisconnectObject( IE );IE.Quit()alert("Disconnected");function ONIE_WindowStateChanged(state){    alert("Event: Window State Changed to "+state);}// Raised from loading a document in Internet Explorerfunction ONIE_DownloadBegin(){    alert("Event: Download begins");}/* Raised from quitting Internet Explorer, but we're * disconnecting from the object before calling * the Quit method to terminate Internet Explorer, so  * the dialog box isn't shown. */function ONIE_OnQuit(){    alert("Event: Quit Internet Explorer");}




Readme.html:

   
   Test    Enter:  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.