PDA

View Full Version : Change the Title of an HTML page


OMID SOFT
04-28-04, 07:48 PM
We are using the "DHTML Edit Control for IE5" as a component.
Now I'm going to change the Title of loaded HTML document in the Editor.
The following code should be correct :
MainForm.Editor.DocumentTitle = "New Title for HTML Page"
But I get this error :
"Wrong number of arguments or invalid property assignment."
Please note that, Title is surrounded by the :
<TITLE> & </TITLE>
Thank you.
Omid Soroori of OMID SOFT.

OMID SOFT
05-09-04, 06:04 AM
I didn't receive any answer within a week.
OK, here is the answer :
-
'Replace Title
If txtTitle.Text <> MainForm.Editor.DocumentTitle Then
PI = InStr(LCase(MainForm.Editor.DocumentHTML), "<title>")
PJ = InStr(LCase(MainForm.Editor.DocumentHTML), "</title>")
PH = Mid(MainForm.Editor.DocumentHTML, PI, PJ - PI + 8)
PM = "<title>" + txtTitle.Text + "</title>"
MainForm.Editor.DocumentHTML = Replace(MainForm.Editor.DocumentHTML, PH, PM)
End If
-
Have a nice day !
Thank you.
Omid Soroori of OMID SOFT.