ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / HTML file functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Searches for elements whose "class" attribute matches a specific value in an HTML document (or in an HTML node).
Example
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
Component: wd300html.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help