Wednesday:
Elements/Elements_JSON_Table_fixsort.htm
The original data file had a different structure.
Elements/elements.json
The code in Elements/Elements.htm use
the key-value associative array approach to handle the JSON file in its original format.
MakeJSON.htm A JavaScript program (needs improvement)
that allows a user to enter CSV formatted data and produce JSON formatted data.
Lab (start together) Turn the information found at
https://www.w3schools.com/colors/colors_names.asp
into a key-value style JSON file. (One way is to open the page in IE and copy the table to Excel, add some of the desired
features/delimiters, then save it as CSV. Open the CSV in Notepad/Notepad++ and use Replace to put the file into the
desired format.) It should look somewhat like:
{
"red":"#f00",
"green":"#0f0",
"blue":"#00f",
"cyan":"#0ff",
"magenta":"#f0f",
"yellow":"#ff0",
"black":"#000"
}
(Note that this is not the format made by the MakeJSON.htm file above.) Then make a page that uses jQuery to read the JSON file and load the color names into a drop-down select. Have a div next to
the drop-down select that changes to the selected color when the uses changes the value of the drop-down select.
Due: Mar. 22