WeBWorK Problems

Playing with javascript in function setAppletCoefficients()

Re: Playing with javascript in function setAppletCoefficients()

by Nicole Wilson -
Number of replies: 0
I found a way to make this work and now have three very pretty templates for making simple graphs, digraphs, and small multigraphs.

The trick was to save the list of vertices labels (one letter names) and the list of edges (two letter names) to strings. In the javascript portion of the code, I saved the literal string to a variable with a nice short name and used the length and charAt methods to access the vertex and edge names.

However, this won't generalize all that well.
I could see doing this using delimiters for longer names or even integers if I had to but it would be a complete nightmare with a list of rational numbers.