"pipe" <au********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
My problem is that i need an algorithm parse parse HTML.
For an HTML page, my script has to parse all tags to get all forms
values, even if there is frame, iframe, ...
How can i do such a script ?
gee, i dont know, can you?
Thanks
iframes may give you problems, since sometimes, you can get the access
denied msg,
other than that, i would use the innerHTML, and then some old fashoned
regexp work,
but there are probably better ways...
I was hoping someone in-the-know would respond to this request,
as I'm interested in a solution myself.
Your subject line is "parsing the DOM", while your post
implies simply parsing HTML tags.
If that's the case, I've done this before by simply placing each tag into
an array element. This could be easily adapted to include iframes
and frames, the content of which must be within the same domain.
Very crude solution....
// -------------------------------
// array to hold all html tags
arrayOfTags = new Array();
// populate array
function parseHTML(HTMLcontent) {
// split at <
var re = "<"
arrayOfTags = HTMLcontent.split(re)
// restore split separator
for (var i = 1; i < arrayOfTags.length; i++) {
arrayOfTags[i] = "<" + arrayOfTags[i]
}
}
function outPut(n) {
alert(arrayOfTags[n])
}
// -------------------------------------
<div onclick="outPut(1)">click to see array element 1</div>
-alu