Community discussion forum

Javascript execution

  • 6 years ago

    I am trying to execute javascript from vb using execScript method. I tried simple one and it is working fine.


    Ex:
    Call WebBrowser1.document.parentWindow.execScript("myfunction()", "JavaScript")


    <script type="text/javascript">
    function myfunction()
    {
    alert("HELLO")
    }
    </script>




    But how to run javascript if script element contains src, not having functions?


    Ex:
    <SCRIPT LANGUAGE="JavaScript" SRC="/myscripts/abc.js"></SCRIPT>



    Thanks in advance


    -kv


  • 6 years ago

    Well assuming the linked document contains functions i would assume you would reference them in the same way?


    Or have u tried that and it didnt work?

  • 2 years ago

    I have a similar problem with VB6 WebBrowser

    Call WebBrowserTrader.document.parentWindow.execScript(A:MyHome.js, "JavaScript")

    when this tries to execute, I get:

    Javascript error

    line 1

    char 3

    Error MyHome.js is undefined:

    Whereas the first few lines of MyHome.js are::

    <head>
     <title>Homeland</title>
     <META NAME="TITLE" CONTENT="TD AMERITRADE Izone Trading Home">
     <META NAME="DESCRIPTION" CONTENT="Your customizable account home page, which displays information you choose, including account details and market data.">
     <!-- version is appended to universal.css and js to ensure lastest scripts and css in case didnt login via new site-->
     <script language="javascript" src="/amer/scripts/universal.js?prdkclstxapp08.clientsys.local  - dev_WEB_2007_05_month_BUILD_12"></script>
     <script language="javascript">





    The code I am trying to execute is exactly the code downloaded by the server except I removed the first line which was:

    <HTML>

    and the last line, which was

    </HTML>

    This being the source that loaded the 'Home' page to my WebBrowser as the client.

    Can anyone help?

    Thanks:

    "Good software like good food takes time to prepare"

    Winnie-the-Pough

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback