FindHtmlTag

Top  Previous  Next

Sub FindHtmlTag($source As String, $tagName As String, $paramName As String, ByRef $startPos As Integer, ByRef $length As Integer) As Boolean

 

Searches in $source for the first occurrence of the HTML tag $tagName that contains the parameter $paramName.

 

FindHtmlTag is case-insensitive. The first character in $source has the position 1. If $tagName and $paramName are found, FindHtmlTag returns TRUE.

 

Parameters

 

$source ... String expression sought.
$tagName, $paramName ... String expressions. HTML tag with parameter being searched.
$startPos ... Index of tag start.
$length ... Length of found tag.

 

Example:

Dim $s, $iStart, $iLen

 

$s = "Click <a href=info.htm>here</a> for more information"

If FindHtmlTag($s, "a", "HREF", $iStart, $iLen) Then

   ' returns $iStart = 7, $iLen = 17

   

   $s = Mid($s, $iStart, $iLen)

   ' returns $s = "<a href=info.htm>"

End If