473,409 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Eval(array)

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.

Jun 15 '06 #1
4 5312
"e271828" <em*****@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
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
Jun 15 '06 #2
JRS: In article <11**********************@g10g2000cwb.googlegroups .com>
, dated Wed, 14 Jun 2006 20:46:28 remote, seen in
news:comp.lang.javascript, e271828 <em*****@gmail.com> posted :
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 don't really follow your terminology; an example of the data might
help.
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.


There's a basic Bar Chart demo at
<URL:http://www.merlyn.demon.co.uk/js-misc1.htm#BC>;
but it does not use eval.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jun 15 '06 #3
"e271828" <em*****@gmail.com> writes:
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jun 15 '06 #4
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.

Jun 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: José Luis Ramírez | last post by:
Hi, I'm trying to recreate an array from a var_export()'ed array stored in a database, using eval(). Basically I have something this in my database: array ( 0 => 1, 1 => 2,
10
by: Ant | last post by:
Hi, I'm using an associative array to simulate a multidimensional array like this: myArray = "John"; myArray = "35"; myArray = "12345"; myArray = "01/01/1975";
8
by: JS | last post by:
I am trying to add an element to an array like this: var ty = ; zz = "ty"; var ab = null; zz+=""; ab = eval(zz); document.write(ab.length);
6
by: Andreas Thiele | last post by:
Hi, I'm very new to php. In my current code I'd like to bind variables to the values of a simply (only indexed by numbers http://www.php-center.de/en-html-manual/language.types.array.html])...
1
by: Eric Newton | last post by:
Given databinding an array of System.Version types: Given that "SomeObject" type has a Version property: public class SomeObject { public Version Version { get; } public string Description {...
4
by: bienwell | last post by:
Hi all, Data displayed on the datalist control is bound by the column name of the dataset like this : <%# DataBinder.Eval(Container.DataItem, "title")%> Could I use an element of the array...
5
by: R | last post by:
Hi All, I'm using eval and arrays in foreach and have trouble with adding elements to them - I'm talking about the '' operator. My code is: // creates arrays with the names of columns in...
7
by: Darko | last post by:
Hello, I have this particular problem with eval() when using Microsoft Internet Explorer, when trying to define an event handler. This is the code: function BigObject() { this.items = new...
1
by: Darkside138 | last post by:
I'm working on a program that takes a saved variable file and converts it to a string that is structured like a php array. My problem is I need to turn this string into an array in php. Hoping...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.