HTML DOM usage?

  • Thread starter Thread starter Mike D Sutton
  • Start date Start date
M

Mike D Sutton

First off apologies if this is the wrong group(s) to post this too, not quite sure where it would be best suited, if anyone knows of
a better location then please let me know.
I've recently been playing about with the HTML DOM but it seems somewhat cumbersome and only offers read-only functionality unless
I'm using it very wrong, in which case how do I go about using it properly? Is there any way that the DOM can be used to
programmatically build HTML documents from scratch or edit existing ones (i.e. injecting data into forms and such, perhaps even
following links? - <a> tags and <input> buttons) in a similar fashion as the XML DOM (which is wonderful in comparison!)
This is only for personal use so even kludgy solutions welcome!
Cheers,

Mike

Using: VB6, MSHTML TypeLib v6.0.2800, WinXP/2K

- Microsoft Visual Basic MVP -
E-Mail: (e-mail address removed)
WWW: Http://EDais.mvps.org/
 
Mike D Sutton said:
First off apologies if this is the wrong group(s) to post this too,
not quite sure where it would be best suited, if anyone knows of
a better location then please let me know.


Have you tried looking at the list of "newsgroups" here:

http://msdn.microsoft.com/newsgroups/

E.g. mouse over the menus on the left and look at the newsgroup names
that show up the IE Status bar.

BTW just entering HTML DOM in the Search for: field
seems to have yielded some useful clues for specific newsgroups
and MVP or MSFT responder names to help refine subsequent
searches.


Good luck

Robert Aldwinckle
---
 
I just took a look at it at: http://www.w3schools.com/htmldom/

They are explaining that HTML DOM is a way to change
the style and / or content of HTML objects. An HTML
object is simply an HTML tag. XHTML is moving away
from using <b> and <i> tags and I don't think browsers
will ever drop support for the tags, w3.org is kind of saying
do it properly but no one is listening.

This is usually done via a scripting language. JavaScript is
probably the best way to tackle it on the client-side and
then whatever server side scripting language could be
used for the server side, ie .asp, .aspx, .pl, .php. Being
that your wanting to manipulate the presentation on the
client-side, I usually think of it in terms of javascript. It's
like Microsoft has their client-side vbScript but I'm not
listening.

The example that found at:
http://www.w3schools.com/htmldom/
uses JavaScript to change the background-color. The same
thing can be applied to forms/<input> textboxes, <select>
listboxes, etc.

There's a sample script using javascript to demonstrate
changing info in various textboxes here.
http://www.microcosmotalk.com/tech/scripts/

There's a number of things you need to consider. I've stuck
with XHTML Transitional for most everything since 1998
or maybe earlier... (when it was called XML and HTML).
That link will work as both XHTML and HTML but will
validate as neither. The reason the validation fails, is
because I never figured out what action="" property to
give the form, because I don't want the form to dance,
but for some reason the <form> tags are needed. If you
know how to supply a blank action, let me know. I just
never figured it out...

Hey! Well that took care of that: It validates now.

<form name="form1" action="">

I don't know if that is something knew or if I just never
tried to fix it. Thanks...
http://validator.w3.org/

Anyways, the javascript file at
http://www.microcosmotalk.com/tech/scripts/
demonstrates how to put info into <input type="text" /> boxes.

The whole idea of DOM sits in the back of my head as:
javascript using document.formx.oName to access and change
the contents of html elements. I keep the concept of CSS as
a the style and formatting of the html elements. So javascript
provides access to HTML via methods, events, properties of
HTML objects.

By the way I left the HTML 4.01 validation to fail currently,
because it displays properly in browsers, and it DOES validate
as valid XHTML 1.0 Transitional. By typing in the URI at:
http://validator.w3.org/ and by using the validator, you'll get
a good feel for the differences of HTML 4.01 and XHTML.

Hope that helps.

--
Jim Carlock
Post replies to newsgroup.

Robert Aldwinckle said:
First off apologies if this is the wrong group(s) to post this too,
not quite sure where it would be best suited, if anyone knows of
a better location then please let me know.


Have you tried looking at the list of "newsgroups" here:

http://msdn.microsoft.com/newsgroups/

E.g. mouse over the menus on the left and look at the newsgroup names
that show up the IE Status bar.

BTW just entering HTML DOM in the Search for: field
seems to have yielded some useful clues for specific newsgroups
and MVP or MSFT responder names to help refine subsequent
searches.


Good luck

Robert Aldwinckle
---
 
Back
Top