0

ページに Java スクリプトがあり、関数から vb.net コード ビハインドから呼び出したいのですが、それを呼び出したくありませんでした (onload または onclick または同様のイベント) が、looping.so を実行している関数から呼び出したい1回以上実行されます

4

2 に答える 2

3

あなたはこのようにする必要があります:

 ' Define the name and type of the client scripts on the page. 
    Dim csname1 As [String] = "PopupScript"
    Dim cstype As Type = Me.[GetType]()

    ' Get a ClientScriptManager reference from the Page class. 
    Dim cs As ClientScriptManager = Page.ClientScript

    ' Check to see if the startup script is already registered. 
    If Not cs.IsStartupScriptRegistered(cstype, csname1) Then
        Dim cstext1 As New StringBuilder()
        cstext1.Append("<script type=text/javascript> getval('elementid') </") 'Your javascript function
        cstext1.Append("script>")

        cs.RegisterStartupScript(cstype, csname1, cstext1.ToString())
    End If

ソース。

于 2012-05-08T11:24:41.443 に答える
0

これは、SignalR を使用して実際に可能です。

https://github.com/SignalR/SignalR

とてもクールなもの。

永続的な接続は、探していることを実行するように聞こえます。

https://github.com/SignalR/SignalR/wiki/PersistentConnection

于 2012-05-08T12:24:53.960 に答える