dynamically generating javascript statements

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

    dynamically generating javascript statements

    Hi!
    I'm new to javascript and I'd like to know whether javascript can
    process javascript-code entered by the user or read from a file.

    We've got an application that uses ActiveX as main customization
    means and we'd like to write a javascript control which listens
    to a socket, reads a javascript statement accessing some ActiveX classes
    and then executes that statement. The applicatoin doesn't know beforehand
    which classes are there.

    Lots of Greetings!
    Volker
  • Martin Honnen

    #2
    Re: dynamically generating javascript statements



    Volker Hetzer wrote:[color=blue]
    > I'm new to javascript and I'd like to know whether javascript can
    > process javascript-code entered by the user or read from a file.[/color]

    Yes, the function
    eval
    takes a string with JavaScript source code as its arguments and
    evaluates the code.

    --

    Martin Honnen


    Comment

    • Volker Hetzer

      #3
      Re: dynamically generating javascript statements


      "Martin Honnen" <mahotrash@yaho o.de> schrieb im Newsbeitrag news:3f9fde6c$1 @olaf.komtel.ne t...[color=blue]
      >
      >
      > Volker Hetzer wrote:[color=green]
      > > I'm new to javascript and I'd like to know whether javascript can
      > > process javascript-code entered by the user or read from a file.[/color]
      >
      > Yes, the function
      > eval
      > takes a string with JavaScript source code as its arguments and
      > evaluates the code.[/color]
      Perfect!
      Thanks a lot!
      Volker

      Comment

      • Dr John Stockton

        #4
        Re: dynamically generating javascript statements

        JRS: In article <3f9fde6c$1@ola f.komtel.net>, seen in
        news:comp.lang. javascript, Martin Honnen <mahotrash@yaho o.de> posted at
        Wed, 29 Oct 2003 16:36:10 :-[color=blue]
        >
        >Volker Hetzer wrote:[color=green]
        >> I'm new to javascript and I'd like to know whether javascript can
        >> process javascript-code entered by the user or read from a file.[/color]
        >
        >Yes, the function
        > eval
        >takes a string with JavaScript source code as its arguments and
        >evaluates the code.[/color]

        And <URL:http://www.merlyn.demo n.co.uk/js-quick.htm> does just the
        former that, when the Eval button is pressed.

        H'mmm - it can read from a file, too, if one enters something like


        <script type="text/javascript" src="include1.j s">
        </script>
        <script type="text/javascript">
        document.write( LZ(3))
        </script>

        and presses HTML. Function LZ is supplied by include1.js.

        --
        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
        <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

        Comment

        Working...