Friday, 4 April 2014

Roman Numerals

I'm actually quite proud to say that this is my first self-directed web programming project. Here's the result.


If you click on the picture, or follow this link, you'll go to the Codebit itself on Codecademy. You'll find that you can type a number in the first box and the second box will automatically update to show the associated numeral as you type! It might not seem like much, but I was so happy when I figured out how to do that.

Further, if you're living dangerously, you can type a valid numeral in the second box and the first will update to show you the associated number in base 10. Mindblowing.

I used HTML and CSS to specify the layout and colours and fields, then I wrote two JavaScript functions: the first to convert from an integer to a numeral, the second to do it the other way round. I then used jQuery to keep track of changes to the two input fields and, on detection, to update the other one.

The main thing I've taken away from this is that layout is hard. I'm going to have to take a good look at some more HTML and CSS tutorials before I attempt another mini-project. I know that you only learn by doing these things, but it would be nice to know which ways are good practice and which aren't.

No comments:

Post a Comment