dynamically generating javascript statements

V

Volker Hetzer

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
 
M

Martin Honnen

Volker said:
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.

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

Volker Hetzer

Martin Honnen said:
Yes, the function
eval
takes a string with JavaScript source code as its arguments and
evaluates the code.
Perfect!
Thanks a lot!
Volker
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
news:comp.lang.javascript said:
Yes, the function
eval
takes a string with JavaScript source code as its arguments and
evaluates the code.

And <URL:http://www.merlyn.demon.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.js">
</script>
<script type="text/javascript">
document.write(LZ(3))
</script>

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top