|
|
|
|
|
HTMLFindElementByClass (Function) In french: HTMLChercheElémentParClasse Searches for elements whose "class" attribute matches a specific value in an HTML document (or in an HTML node). d is htmlDocument = HTMLOuvre("https://www.pcsoft.fr", fromURL)
e is array of htmlNode <- HTMLChercheElémentParClasse(d, "Red")
Syntax
<Result> = HTMLFindElementByClass(<Element to handle> , <Sought Class attribute>)
<Result>: Array Array of htmlNode elements that match the search condition. <Element to handle>: htmlDocument or htmlNode variable Element where the search will be performed: <Sought Class attribute>: Character string Value of the "Class" attribute to be searched for. Remarks HTMLFindElementByClass respects the rules for "selecting" HTML elements according to their class(es): - search for the different classes separated by spaces; all the requested classes must be present ("AND" search).
- case-sensitive search (generally, classes are in lowercase characters).
- search ignoring duplicates.
Example: d is htmlDocument
d.html.body.span[1]:id = "1"
d.html.body.span[1]:class = "ab"
d.html.body.span[2]:id = "2"
d.html.body.span[2]:class = "ab cd"
d.html.body.span[3]:id = "3"
d.html.body.span[3]:class = "cd"
d.html.body.span[4]:id = "4"
d.html.body.span[4]:class = "ab cd ab"
t is array of htmlNode
Trace("-- ab")
t = HTMLFindElementByClass(d, "ab")
FOR EACH x OF t
Trace(x:id)
END
Trace("-- cd")
t = HTMLFindElementByClass(d, "cd")
FOR EACH x OF t
Trace(x:id)
END
Trace("-- ab cd")
t = HTMLFindElementByClass(d, "ab cd")
FOR EACH x OF t
Trace(x:id)
END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|