HighDots Forums  

IE Text Input

Javascript JavaScript language (comp.lang.javascript)


Discuss IE Text Input in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ron
 
Posts: n/a

Default IE Text Input - 04-20-2004 , 05:12 PM






You know how some web pages require text input, well I'm doing this by
running a VBA macro out of Excel. The macro opens IE to the desired
url and the following lines of code insert the required text:

Set ipf = ie.document.all.Item("XYZ")
ipf.Value = "ABC"

This usually works fine, but sometimes, after reviewing the source
code behind the web page, I still can't figure out the correct "item"
name. Is there some VBA code that would allow the macro to list the
names of all of the "Items" for the document (e.g. the open web page),
so that I could look at them and pick the one I need?...TIA, Ron

Reply With Quote
  #2  
Old   
kaeli
 
Posts: n/a

Default Re: IE Text Input - 04-21-2004 , 07:56 AM






In article <1807c7b7.0404201412.51394706 (AT) posting (DOT) google.com>,
oitbso (AT) yahoo (DOT) com enlightened us with...
Quote:
You know how some web pages require text input, well I'm doing this by
running a VBA macro out of Excel. The macro opens IE to the desired
url and the following lines of code insert the required text:

Set ipf = ie.document.all.Item("XYZ")
ipf.Value = "ABC"

This usually works fine, but sometimes, after reviewing the source
code behind the web page, I still can't figure out the correct "item"
name. Is there some VBA code that would allow the macro to list the
names of all of the "Items" for the document (e.g. the open web page),
so that I could look at them and pick the one I need?...TIA, Ron

Well, since I don't know what kind of element(s) Item is, I have to
guess. Try this.

This is a javascript group, and the following code is in javascript, so
change it to VBA as you need.

// IE only code!! Use real code instead of this IE shortcut (with a
form) for multi-browser.

var e = document.all.Item
for (var i=0; i<e.length; i++)
{
var eName = e[i].name;
// do whatever with e[i] based on eName
}

Note that if there is only one Item element, the above code will NOT
work, as the loop would never run (length is undefined b/c it won't be
an array). Add checking for that if it is a possibility.

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.