Miscellaneous Stata materials from Austin Nichols:
Recently,
some people asked on Statalist how one might use Stata to make a set of graphs with a drop-down menu as in
this blog post about DC schools. It is straightforward to write out html files using the file command, so this
is more a question about HTML or JavaScript. There are a number of approaches to doing this kind of thing in
JavaScript, including the powerful jQuery,
and plenty more using PHP or some kind of server-side processing, but here are a couple of simple approaches.
- Make a dropdown menu that reloads the page, replacing it with a new page that has a different image.
Here is example code and the result looks like this.
- Make a dropdown menu that uses getElementsByClassName to replace the image in the current page with a new image.
Here is example code and the result looks like this.