Results 1 to 6 of 6

Thread: execSript

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220

    execSript

    I have a link for the msdn on the execScript but i cant seam to run it

    can some1 perhaps post a form with it working with a javascript function in a html doc on a webbrowser control or offer some advice.

    Tnx in advance

    Adz

  2. #2
    Addicted Member
    Join Date
    Mar 2001
    Location
    Greece
    Posts
    184
    Suppose there is a Submit function that accepts 2 parameters in the third frame of a document. wb is the webbrowser object. The following code works fine for me.

    VB Code:
    1. wb.Document.frames(3).Document.parentWindow.execScript("Submit(" & myvar1 & "," & _
    2.            myvar2 & ")", "JavaScript")

    If you still have problems send us your code!

    Good luck!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    firstly what is the frames bit, and secondly is that running two variables??

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    ok im really lost i have a basic javascript function of names Msg in the html doc that is in the webbrowser1

    the html doc is pure basic, with no frames. im a bit lost i have no code coz all i got is a button (command1) and a webbrowser control (webbrowser1)

    the form load has the navigation to the url and that is it. what do you put in command1 to run the msg function in the html doc

    Thanks Adz

  5. #5
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    As little as this:
    VB Code:
    1. WebBrowser1.Document.parentWindow.execScript("Msg()")
    Actually from JavaScript you would call the execScript function like this: window.execScript, but since the WebBrowser control doesn't have a Window property, you need to call Document.parentWindow to get a handle on the window object.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    Ok great got the basics done im gonna do some Javascript research and ill be bac with another post to this for more Q.

    tnx All

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width