Results 1 to 3 of 3

Thread: HTML document tool

Threaded View

  1. #3

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: HTML document tool

    You can use the algorithm of the Forward button, that will walk thru on each tags. But, it will skip <script> and <style> tags! That means, a <script src=".."> will not be replaced. Its better to replace the code that does the skip, also comment out the <style> things.

    For example, this will look for all <!-- --> tags and skip their content. These are the standards that used inside the <script and <style tags, to comment out the content, but the content will be interpreted by the browser, just wont show them.

    vb Code:
    1. 'in Private Sub cmdForward_Click() ...
    2. If InStr(1, LCase(Mid$(sHTMLDocument, Text1.SelStart, lSelLength)), "<!--", vbTextCompare) > 0 Then
    3.     lNewIndex = InStr(Text1.SelStart + lSelLength - 4, LCase(sHTMLDocument), "-->", vbTextCompare) + 3:
    4.     If lNewIndex < (Text1.SelStart + lSelLength - 4) Then lNewIndex = 0
    5.     GoTo ReCheck
    6. End If
    7.  
    8. '  If InStr(1, LCase(Mid$(sHTMLDocument, Text1.SelStart, lSelLength)), "<style ", vbTextCompare) > 0 Or _
    9. '    InStr(1, LCase(Mid$(sHTMLDocument, Text1.SelStart, lSelLength)), "<style>", vbTextCompare) > 0 Then
    10. '    lNewIndex = InStr(Text1.SelStart + lSelLength - 9, LCase(sHTMLDocument), "</style>", vbTextCompare) + 9: GoTo ReCheck
    11. '  End If

    After this modification, you can use the algo to walk thru the tags, that there you can execute the replacement for each src (cmdAuto2) and href (cmdAuto3) properties.
    You can also try to combine the algos of cmdAuto2 and cmdAuto3.
    Last edited by Jim Davis; Nov 26th, 2008 at 02:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width