put an html button on the page with an onClick event handler that calls the
javascript function
server-side script can't call client-side script functions
"Florin" <EMAIL REMOVED> wrote in message
news:EMAIL REMOVED om...
> Hi,
>
> How can get the javascript using a button Command1 ?
> I want to create the html on the fly.
> This one doesn't work:
>
> Private Sub Command1_Click()
> WebBrowser1.Navigate "javascript:callAlert()"
> End Sub
>
> Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
>
> Dim sHTML As String
> sHTML = "<P>This is some text.</P>"
>
> sHTML = sHTML & "<script type=""text/javascript"">" & vbCrLf
> sHTML = sHTML & "<!--" & vbCrLf
> sHTML = sHTML & "function callAlert(){" & vbCrLf
> sHTML = sHTML & "alert(""Test"");" & vbCrLf
> sHTML = sHTML & "}" & vbCrLf
> sHTML = sHTML & " //-->" & vbCrLf
> sHTML = sHTML & "</script>" & vbCrLf
>
> WebBrowser1.Document.body.innerHTML = sHTML
>
> End Sub
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004