1

我们有真正的人数统计 AXI 摄像机,可以计算进入大楼的人数。我们可以在网页上看到实时视图和计数。我想在没有任何动画的屏幕上显示计数结果。我想过在 vb.net 中使用 webbrowser 控件来加载实时视图网页,然后在 webbrowser 中注入 javascript 并在文本框中显示计数。这是我的代码,但我不断收到有关 javascript 文本的错误消息,感谢任何帮助

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.WebBrowser3.Navigate("http://10.xx.xxx.xx/people-counter/liveview.html"

Private Sub WebBrowser3_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) 处理 WebBrowser3.DocumentCompleted

    Dim mScript As HtmlElement
    Dim mHead As HtmlElement
    Dim element As mshtml.HTMLScriptElement


    With WebBrowser3
        mHead = WebBrowser3.Document.GetElementsByTagName("head")(0)
        mScript = .Document.CreateElement("script")
        mScript.SetAttribute("type", "text/javascript")
        element = mScript.DomElement
        element.text = "$(function showcount(){$("#video").countingArea($.extend({},cntarea,{displayWidth:320,displayHeight:240,mjpgUrl:"/axis-cgi/mjpg/video.cgi?resolution=320x240",jpegUrl:"/local/people-counter/.api?image.jpg",fps:12}));$.liveviewWithTable({countsTableElement:$("#counts"),countTableElement:$("#count"),directionIn:$.getParam("Counter.DirectionIn"),liveSumUrl:"/local/people-counter/.api?live-sum.json",loadingAnimationUrl:"/people-counter/images/ajax-loader.gif",dataTypes:["in","out"],strings:{"x second ago":"%d second ago","x seconds ago":"%d seconds ago","x minute ago":"%d minute ago","x minutes ago":"%d minutes ago","x hour ago":"%d hour ago","x hours ago":"%d hours ago","x day ago":"%d day ago","x days ago":"%d days ago","x week ago":"%d week ago","x weeks ago":"%d weeks ago","x month ago":"%d month ago","x months ago":"%d months ago","x year ago":"%d year ago","x years ago":"%d years ago"}})});"

        mHead.AppendChild(mScript)
        .Document.InvokeScript("showcount")
    End With
End Sub
4

0 回答 0