Eval(array)

E

e271828

I am trying to develop a rudimentary graphing program which uses the
eval() function to execute some innerHTML and getElementById. I can
reflect strings so that you can type something into a field and have it
immediately reflected, but have no such luck with splitting that string
into an array dynamically and having that reflected.

I'd like to have it take the string typed into a text field, split that
along commas in the string into an array, then pass that array as a
variable to a parameter in another function. I can declare the data
(heights of a bar graph) by hard-writing it into the code, which works
fine, but have yet to have any luck on making it respond to client-side
input. It seems like this could be done. I'd greatly appreciate any
advice from those more experienced JS.
 
A

Aaron Gray

e271828 said:
I am trying to develop a rudimentary graphing program which uses the
eval() function to execute some innerHTML and getElementById. I can
reflect strings so that you can type something into a field and have it
immediately reflected, but have no such luck with splitting that string
into an array dynamically and having that reflected.

I'd like to have it take the string typed into a text field, split that
along commas in the string into an array, then pass that array as a
variable to a parameter in another function. I can declare the data
(heights of a bar graph) by hard-writing it into the code, which works
fine, but have yet to have any luck on making it respond to client-side
input. It seems like this could be done. I'd greatly appreciate any
advice from those more experienced JS.

Sounds like you need a basic JS tutorial.

You may also be interested in Walter Zorn's JS Graphics routines :-

http://walterzorn.com/jsgraphics/jsgraphics_e.htm

Aaron
 
L

Lasse Reichstein Nielsen

e271828 said:
I am trying to develop a rudimentary graphing program which uses the
eval() function to execute some innerHTML and getElementById.

Sounds, unnecessarily, convoluted.
I can reflect strings so that you can type something into a field
and have it immediately reflected, but have no such luck with
splitting that string into an array dynamically and having that
reflected.

I'm not sure exactly what you mean by "reflected".
I'd like to have it take the string typed into a text field, split that
along commas in the string into an array, then pass that array as a
variable to a parameter in another function.

anotherFunction(string.split(/,/g));

/L
 
E

e271828

Thanks, everyone, for the replies. I ended up getting the dynamic bar
chart to work after a decent amount of head-banging. The chart can be
found here: http://people.umass.edu/eweitz/chaht.html. To use it,
enter positive numbers separated by commas (without spaces) into the
text field. The script takes the values of the text field and, on a
key release, makes them comma-separated values which are fed into an
array for client-side processing. The Javascript can be found at
http://people.umass.edu/eweitz/barchart.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

Similar Threads


Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top