Re: Focus in webbrowser Control
- From: "Mark J. McGinty" <mmcginty@xxxxxxxxxxxxxxx>
- Date: Mon, 1 May 2006 20:56:38 -0700
"???" <hanansa88@xxxxxxxxxxx> wrote in message
news:DF9B04BC-A257-4F4D-AB20-95449A4B4A7F@xxxxxxxxxxxxxxxx
"Mark J. McGinty" wrote:
"???" <hanansa88@xxxxxxxxxxx> wrote in message
news:835203C7-D3D1-42CF-8B80-44B11204B150@xxxxxxxxxxxxxxxx
Hi There,
I'm using a webbrowser control in my project (VB 6.0), and I want to
".setfocus" on certain control in the webbrowser it selt. For example,
if
I
want to focus on a certain picture in a site I won't have to press
"tab"
for
many times, but I just press something like
"webbrowser1.picture1.setfocus",
just like in a form when I want to focus on a textbox I write
"Text1.setfocus", does anyone know how to do that?
You will have to manipulate the DOM (exposed as the webbrowser.Document
property) just as you would do in script, inside the HTML document.
Something like:
webbrowser.Document.all("id_of_element").focus
-Mark
Thank you.
I Still quite didn't understand whatI need to do because I'm not that
familiar with DOM (whatever it means...)
DOM = document object model, with which HTML documents can be dynamically
manipulated. The root object in this hierarchy is the "document" object, as
standardized by W3C (and extended by Microsoft.) The webbrowser control
exposes a Document property; it is the document object of the web page
that's been opened in the webbrowser control.
Giving focus to an element within an HTML document requires DOM-level calls;
specifically, the focus method, supported by many different element types.
All you have to do is figure out how to consistently obtain an object
reference to the element you want to focused. If that element has an id
attribute, and it's unique in the document, it's easy. If not, it becomes a
little more challenging.
Here's a link to MS tech ref:
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
And here's a link to an IE extension that I've written, that allows you to
browse the DOM of any web page that displayed in IE [unless it eats the
contextmenu (right-click) event]:
http://www.pagespy.com
-Mark
.
- Prev by Date: Re: vb6 [multiposted]
- Next by Date: Re: Problem displaying text in japanese in labels only
- Previous by thread: Re: vb6 [multiposted]
- Next by thread: Re: Problem displaying text in japanese in labels only
- Index(es):
Relevant Pages
|