WebBrowser1.InnerHTML |
Post Reply |
Author | |
CDias
Newbie Joined: 06 January 2012 Location: Brasil Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 06 January 2012 at 7:42pm |
I'm having problems with the component WebBrowser. If I load the file normally, the script works. For example: WebBrowser1.Navigate App.Path & "\Html\samplepage.html" WebBrowser1.SetObjectForScripting Me Where samplepage.html: <html> <head> <SCRIPT LANGUAGE="JavaScript"> function button_click() { if (window.external != null) { window.external.ClickFromHTML(); } else { alert("Messagebox from HTML "); } } </SCRIPT> </head> <body> <button onclick="button_click()">Click me</button> </body> </html> (as in the example available for the component) But if I use the innerHTML property of the component, the script does not work. For example: Dim HTML As String HTML = "<html>" HTML = HTML & "<head>" HTML = HTML & "<SCRIPT LANGUAGE=" & Chr(34) & "JavaScript" & Chr(34) & ">" HTML = HTML & "Function button_click()" HTML = HTML & "{" HTML = HTML & " if (window.external != null)" HTML = HTML & " {" HTML = HTML & " window.external.ClickFromHTML();" HTML = HTML & " }" HTML = HTML & " Else" HTML = HTML & " {" HTML = HTML & " alert(" & Chr(34) & "Messagebox from HTML " & Chr(34) & ");" HTML = HTML & " }" HTML = HTML & "}" HTML = HTML & "</SCRIPT>" HTML = HTML & "</head>" HTML = HTML & "<body>" HTML = HTML & "<button onclick=" & Chr(34) & "button_click()" & Chr(34) & ">Click me</button>" HTML = HTML & "</body>" HTML = HTML & "</html>" WebBrowser1.SetObjectForScripting Me WebBrowser1.InnerHTML = HTML When I click the button, the following error occurs: Apparently, the property InnerHTML do not add the tag <Script Language...></Script> How to fix this? |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |