Bridgewater College home page
 Prof. of Physics / Dir. of Academic Computing
gold bar graphic
 
R. Bowman Home
BC Home
   

Code Projects

A. JavaScript

  1. Making Graphs with Javascript

    While native JavaScript does not have a graphing capability built in, there are a number of libraries that now support graphs. However one simple solution I learned several years ago, uses two one-pixel gif files (one black and one white) and placing next to each other on a web page.

    Example:
    http://people.bridgewater.edu/~rbowman/ISAW/PlanetOrbit.html - On that page click on "Plot the Orbit" and then look at the code of the resulting window, particularly the functions "plot_2d" and "orbit_array.". 
     
  2. Working with Cookies

    If one wants to do a calculation and then present the results in a new web page, one needs to work with cookies to store the dynamic data for the new page. The examples at my ISAW web site uses the cookie functions written by Bill Dortch. Since these functions are more than 10 years old, the web address I give for the full set, in my coding, is no longer functional. This is on my agenda to change in the near future. But the functions do work great as they are!

    Example: http://people.bridgewater.edu/~rbowman/ISAW/ - All four simulations use cookies, so look at all of them for ideas of how to use them. 

B. PHP

  1. Mailing Data from a Web Form

    The script "formmailer.php" accessed by the example here, has been modified from one presented at http://www.TheDemoSite.co.uk . The original made a simple email message from the input of a name, email address, subject, and a query message. I have modified it to send the data from any number of form elements to a designated email address.

    Simple Web Form Example: http://people.bridgewater.edu/~rbowman/code/webform.html - This form was initially used to obtain data for participants of a javascript workshop, but it is here only as an example.

    Email from the Above Form: Here is the text of an email message from the above form.

    Package: http://people.bridgewater.edu/~rbowman/code/formmailer.zip - Un-zip the files on to your server, and try it out. At the beginning of the formmailer.php script, you will need to change several variables that tailor this package to your personal situation.
gold bar graphic
    Return to Bridgewater College ©2004-10 Richard L. Bowman
Maintained by
rbowman@bridgewater.edu ; Last Modified on 2-Sep-10.