Use JavaScript in VB Application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Behzad

    Use JavaScript in VB Application

    Hi All.

    I have a function with javascript is used in my ASP web Page.Now i
    want to write an application with VB6 same as my asp page and i need
    to use that javascript function.Can i insert this function in my VB6
    app.?

    Thnaks.

    Behzad
  • kaeli

    #2
    Re: Use JavaScript in VB Application

    In article <ae42deda.03090 22142.4460cc69@ posting.google. com>, Bsedigh_79
    @yahoo.com enlightened us with...[color=blue]
    > I have a function with javascript is used in my ASP web Page.Now i
    > want to write an application with VB6 same as my asp page and i need
    > to use that javascript function.Can i insert this function in my VB6
    > app.?
    >
    > Thnaks.
    >[/color]

    Not as far as I know.


    -------------------------------------------------
    ~kaeli~
    Press any key to continue or any other key to quit.
    Who is General Failure and why is he reading
    my hard disk?


    -------------------------------------------------

    Comment

    • DWilliams

      #3
      Re: Use JavaScript in VB Application

      Behzad,

      I don't think so, straight VB does not (can't) interpret JS code.

      ASP uses VB syntax and constructs but it only integrates with JavaScript
      because it is a server-side scripting language. In most situations, the Web
      server interprets the ASP code and the client part (browser) interprets the
      JS code.

      Assuming your JS code is not about HTML operations, your best option would
      probably be to re-code the routine's functionality entirely in VB. People
      do it all the time. ;-)

      --
      HTH,
      DWilliams


      "Behzad" <Bsedigh_79@yah oo.com> wrote in message
      news:ae42deda.0 309022142.4460c c69@posting.goo gle.com...[color=blue]
      > Hi All.
      >
      > I have a function with javascript is used in my ASP web Page.Now i
      > want to write an application with VB6 same as my asp page and i need
      > to use that javascript function.Can i insert this function in my VB6
      > app.?
      >
      > Thnaks.
      >
      > Behzad[/color]


      Comment

      • Steve van Dongen

        #4
        Re: Use JavaScript in VB Application

        On Wed, 3 Sep 2003 08:15:38 -0500, kaeli
        <infinite.possi bilities@NOSPAM att.net> wrote:
        [color=blue]
        >In article <ae42deda.03090 22142.4460cc69@ posting.google. com>, Bsedigh_79
        >@yahoo.com enlightened us with...[color=green]
        >> I have a function with javascript is used in my ASP web Page.Now i
        >> want to write an application with VB6 same as my asp page and i need
        >> to use that javascript function.Can i insert this function in my VB6
        >> app.?
        >>
        >> Thnaks.
        >>[/color]
        >
        >Not as far as I know.[/color]

        I suspect it would be more work than it would be worth, but you could
        try hosting the windows script engine. Look on MSDN for details.
        Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


        Regards,
        Steve

        Comment

        • Laurent Bugnion, GalaSoft

          #5
          Re: Use JavaScript in VB Application

          Hi,

          DWilliams wrote:
          [color=blue]
          > Behzad,
          >
          > I don't think so, straight VB does not (can't) interpret JS code.
          >
          > ASP uses VB syntax and constructs but it only integrates with JavaScript
          > because it is a server-side scripting language. In most situations, the Web
          > server interprets the ASP code and the client part (browser) interprets the
          > JS code.[/color]

          Wow, what a mix of concepts here.

          ASP doesn't use VB syntax at all.

          ASP is a platform, it exposes a set of libraries and objects allowing
          accessing OS functionalities . It happens to support two languages "out
          of the box", which are VBScript and JScript (the IE implementation of
          JavaScript). ASP as such doesn't has a syntax. You can use exactly the
          same objects in VBScript, with the VB syntax, and in JScript, with the
          JavaScript syntax.

          You are also wrong when you state that the client part interpretes the
          JavaScript code. The client interpretes the client-side code, and the
          server interpretes the server-side code. The server-side code can be
          pretty much anything, depending on the server type, the server OS, the
          webserver type, etc... it can be Perl, PHP, Java (JSP or servlets),
          JavaScript, JScript, VBScript C/C++, and so many others that's it silly
          to want to list them. On the client, the most widely used language is
          JavaScript, but some browsers (the IE line) can also interprete and run
          VBScript code.

          Don't confuse the platform and the language. A language doesn't say
          anythign about the platform it runs on, and will run exactly as well as
          long as it is supported.
          [color=blue]
          > Assuming your JS code is not about HTML operations, your best option would
          > probably be to re-code the routine's functionality entirely in VB. People
          > do it all the time. ;-)
          >
          > --
          > HTH,
          > DWilliams[/color]

          I agree with others saying that it's probably more work than it's worth
          trying to simply reuse the function as-is.

          Note that if you make the step to .NET (a loooot better than old VB6),
          you have the possibility to use JScript.NET as a programming language
          (still another platform, and quite another language too), but it is not
          said that your function will run as-is on it. It also depends what
          objects from the API you're using, of course.

          HTH,

          Laurent
          --
          Laurent Bugnion, GalaSoft
          Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
          Private/Malaysia: http://mypage.bluewin.ch/lbugnion
          Support children in Calcutta: http://www.calcutta-espoir.ch

          Comment

          • Sean Jorden

            #6
            Re: Use JavaScript in VB Application

            "Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
            news:3f5704f4$1 _3@news.bluewin .ch:
            [color=blue]
            > accessing OS functionalities . It happens to support two languages "out
            > of the box", which are VBScript and JScript (the IE implementation of
            > JavaScript). ASP as such doesn't has a syntax. You can use exactly the
            > same objects in VBScript, with the VB syntax, and in JScript, with the
            > JavaScript syntax.[/color]

            If you really want to strip it down to its essentials I suppose you could
            say ASP is just a multithreaded runtime environment for WSH.

            Comment

            • DWilliams

              #7
              Re: Use JavaScript in VB Application

              Laurent,

              Thanks for that fine lesson, but I don't personally need it.

              The intent here was to clarify for the poster about "typical" uses of how
              the ASP and the JS are interpreted differently, in the environment that HE
              implied. To me, the issue was about being able to "reuse" their JS code in
              VB6, not to elaborate on all the various language and platform technologies.

              --
              HTH,
              DWilliams


              "Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
              message news:3f5704f4$1 _3@news.bluewin .ch...[color=blue]
              > Hi,
              >
              > DWilliams wrote:
              >[color=green]
              > > Behzad,
              > >
              > > I don't think so, straight VB does not (can't) interpret JS code.
              > >
              > > ASP uses VB syntax and constructs but it only integrates with JavaScript
              > > because it is a server-side scripting language. In most situations, the[/color][/color]
              Web[color=blue][color=green]
              > > server interprets the ASP code and the client part (browser) interprets[/color][/color]
              the[color=blue][color=green]
              > > JS code.[/color]
              >
              > Wow, what a mix of concepts here.
              >
              > ASP doesn't use VB syntax at all.
              >
              > ASP is a platform, it exposes a set of libraries and objects allowing
              > accessing OS functionalities . It happens to support two languages "out
              > of the box", which are VBScript and JScript (the IE implementation of
              > JavaScript). ASP as such doesn't has a syntax. You can use exactly the
              > same objects in VBScript, with the VB syntax, and in JScript, with the
              > JavaScript syntax.
              >
              > You are also wrong when you state that the client part interpretes the
              > JavaScript code. The client interpretes the client-side code, and the
              > server interpretes the server-side code. The server-side code can be
              > pretty much anything, depending on the server type, the server OS, the
              > webserver type, etc... it can be Perl, PHP, Java (JSP or servlets),
              > JavaScript, JScript, VBScript C/C++, and so many others that's it silly
              > to want to list them. On the client, the most widely used language is
              > JavaScript, but some browsers (the IE line) can also interprete and run
              > VBScript code.
              >
              > Don't confuse the platform and the language. A language doesn't say
              > anythign about the platform it runs on, and will run exactly as well as
              > long as it is supported.
              >[color=green]
              > > Assuming your JS code is not about HTML operations, your best option[/color][/color]
              would[color=blue][color=green]
              > > probably be to re-code the routine's functionality entirely in VB.[/color][/color]
              People[color=blue][color=green]
              > > do it all the time. ;-)
              > >
              > > --
              > > HTH,
              > > DWilliams[/color]
              >
              > I agree with others saying that it's probably more work than it's worth
              > trying to simply reuse the function as-is.
              >
              > Note that if you make the step to .NET (a loooot better than old VB6),
              > you have the possibility to use JScript.NET as a programming language
              > (still another platform, and quite another language too), but it is not
              > said that your function will run as-is on it. It also depends what
              > objects from the API you're using, of course.
              >
              > HTH,
              >
              > Laurent
              > --
              > Laurent Bugnion, GalaSoft
              > Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
              > Private/Malaysia: http://mypage.bluewin.ch/lbugnion
              > Support children in Calcutta: http://www.calcutta-espoir.ch
              >[/color]



              Comment

              • Laurent Bugnion, GalaSoft

                #8
                Re: Use JavaScript in VB Application

                Hi,

                DWilliams wrote:
                [color=blue]
                > Laurent,
                >
                > Thanks for that fine lesson, but I don't personally need it.
                >
                > The intent here was to clarify for the poster about "typical" uses of how
                > the ASP and the JS are interpreted differently, in the environment that HE
                > implied. To me, the issue was about being able to "reuse" their JS code in
                > VB6, not to elaborate on all the various language and platform technologies.
                >[/color]

                I understand your intent, but it's wrong to state that ASP uses VB
                syntax. I stand by that ;-)

                Sorry if I sounded like I was lecturing you. There are all kind of
                audience in this newsgroup, it's sometimes hard to know who you talk to
                and what their level of knowledge.

                Laurent
                --
                Laurent Bugnion, GalaSoft
                Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
                Private/Malaysia: http://mypage.bluewin.ch/lbugnion
                Support children in Calcutta: http://www.calcutta-espoir.ch

                Comment

                • DWilliams

                  #9
                  Re: Use JavaScript in VB Application

                  Laurent,
                  [color=blue][color=green]
                  >>I understand your intent, but it's wrong to state that ASP uses VB[/color][/color]
                  syntax. I stand by that ;-)<<

                  Perhaps that is technically wrong, but not wholly inaccurate in the
                  context of the poster's message and what he, in my opinion, would have
                  best understood. He obviously saw a correlation between ASP and VB6 or
                  he would not have been thinking about converting the application.

                  Which primary language, syntactically or otherwise, would you have
                  guessed that their ASP application was "oriented" on? I think it would
                  not be JScript.
                  [color=blue][color=green]
                  >>Sorry if I sounded like I was lecturing you. There are all kind of[/color][/color]
                  audience in this newsgroup, it's sometimes hard to know who you talk to
                  and what their level of knowledge<<

                  No harm done, this is the nature of the newsgroups. If you participate,
                  you must be prepared to take some lumps. ;-)

                  And I totally agree with you on the difficulty in understanding
                  someone's technical knowledge. This is why I try to make references in
                  the simplest terms possible if it is a subject/issue I am familiar with.

                  HTH,
                  DWilliams


                  Laurent Bugnion, GalaSoft wrote:[color=blue]
                  > Hi,
                  >
                  > DWilliams wrote:
                  >[color=green]
                  >> Laurent,
                  >>
                  >> Thanks for that fine lesson, but I don't personally need it.
                  >>
                  >> The intent here was to clarify for the poster about "typical" uses of how
                  >> the ASP and the JS are interpreted differently, in the environment
                  >> that HE
                  >> implied. To me, the issue was about being able to "reuse" their JS
                  >> code in
                  >> VB6, not to elaborate on all the various language and platform
                  >> technologies.
                  >>[/color]
                  >
                  > I understand your intent, but it's wrong to state that ASP uses VB
                  > syntax. I stand by that ;-)
                  >
                  > Sorry if I sounded like I was lecturing you. There are all kind of
                  > audience in this newsgroup, it's sometimes hard to know who you talk to
                  > and what their level of knowledge.
                  >
                  > Laurent[/color]

                  Comment

                  • Jim Ley

                    #10
                    Re: Use JavaScript in VB Application

                    On Thu, 04 Sep 2003 15:46:53 GMT, DWilliams
                    <dw59@nojunk.ea rthlink.net> wrote:
                    [color=blue]
                    >Which primary language, syntactically or otherwise, would you have
                    >guessed that their ASP application was "oriented" on? I think it would
                    >not be JScript.[/color]

                    Previously, some time ago now, the Microsoft Script manager at the
                    time, suggested around 40% of ASP work was in JScript. With the
                    arrival of ASP.NET I think we can conclude even less is now in VB
                    syntax.

                    Jim.
                    --
                    comp.lang.javas cript FAQ - http://jibbering.com/faq/

                    Comment

                    Working...