Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 17th, 2003, 08:19 PM
Registered User
 
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default question about Javascript capabilities

Will JavaScript allow me programmatically access a web site? For example, I would like to connect to my bank's web site, signon by providing my ID & password, then navigate to obtain my account balance?

If so, please provide a link to related topics.

Thx

David Woods
 
Old December 18th, 2003, 07:29 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes. You do't say how the code will be hosted, in a web page or a standalone js file. If the former you will need to run in an unsecure zone. A quick example assuming the name text box is called "txtName" and the password box is named "txtPassword" and the form they are in is called "frmLogin".
Code:
var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.navigate("http://www.myBank.com");
while (oIE.busy)
{
  var i = 1 + 2;  //Some VB stylke doevents would be good here.
}
if (oIE.document && oIE.document.frmLogin)
{
  var oDoc = oIE.document;
  oDoc.frmLogin.elements["txtName"].value = "Joe";
  oDoc.frmLogin.elements["txtPassword"].value = "password";
  oDoc.frmLogin.submit();
  while (oIE.busy)
  {
    var i = 1 + 2;
  }
  //Then retrieve balance etc.
}
else
{
  //show error message
}
oIE.quit();
oIE = null;
For IE methods search msdn for iwebbrowser2.



--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS and frameset capabilities paragon CSS Cascading Style Sheets 1 January 11th, 2006 02:08 PM
Question about "floating div" JavaScript [email protected] Javascript 0 April 17th, 2005 12:19 PM
Javascript question on reset and onfocus gilgalbiblewheel Javascript How-To 1 March 10th, 2005 10:50 AM
javascript onclick question robs Javascript 1 January 19th, 2005 05:20 AM
Javascript printing question? macupryk General .NET 0 October 30th, 2004 11:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.