By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,918 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,918 IT Pros & Developers. It's quick & easy.

dynamically generating javascript statements

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


Volker Hetzer wrote:
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.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a

"Martin Honnen" <ma*******@yahoo.de> schrieb im Newsbeitrag news:3f********@olaf.komtel.net...


Volker Hetzer wrote:
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.

Perfect!
Thanks a lot!
Volker
Jul 20 '05 #3

P: n/a
JRS: In article <3f********@olaf.komtel.net>, seen in
news:comp.lang.javascript, Martin Honnen <ma*******@yahoo.de> posted at
Wed, 29 Oct 2003 16:36:10 :-

Volker Hetzer wrote:
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.


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.

--
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.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.