At first, from the books alone, I couldn't figure out how to do the latter and have it pass a button ID's from the HTML code to the JavaScript code. I resorted to searching on Google for a solution and eventually found out how to do it on this particular website, http://www.w3schools.com/. As it turns out, I found from my mentor that many programmers and Computer Science majors use that website as a source for help, guidance, and a place to learn different programming languages. There is also a public forum that allows questions to be asked directly to other users on that site for specific questions that may not otherwise be addressed with general lessons.
The simple interface of my calculator. Includes the functions of adding, subtracting, multiplying, and dividing two numbers, checking to see if users entered values or not, and using a resulting value as the first number of input.
This part of the code detects which number button was pressed and displays its value. It does this by looping through the numbers 0 through 9, determining whether the button's ID matches "Button" + the looping number, and displaying the looping number in the 1st Textbox.
The calculate() function I coded that receives 3 values, the value in the 1st Textbox, the value of the 2nd Textbox, and the value of the operation Textbox. Depending on the operation, the function will do the corresponding calculations to the values of the 1st and second text boxes and display the result in the result Textbox. Note that I also included an exception for dividing anything by 0 in order to prevent the program from breaking the laws of the universe and crash.
On another note, my mentor recently gave me two new books on HTML, CSS,JavaScript, and JQuery that she will help to go over with me as we do mentorship hours. On a first glance, these books looked like the ordinary programming books (and textbooks) with a pretty cover and back cover with black and white, boring walls of text that strain the eyes. But when I opened these books up, not only was I surprised at the color, but I was also impressed my the amount of designing done within the book coming from a design editor's perspective. They were relaxing, easy to read and understand, and, most of all, not boring. Honestly, this is probably the best looking educational book that I've ever seen since reading Dr. Seuss over 10 years ago.
Pretty covers usually attract me enough to read the inside text, but the text usually do not the same as much. These book being an exception.
This back cover is very nice. If I was doing some design work as my senior project, I would even consider using this book as a reference!
The most attractive educational books I've ever seen since Dr. Seuss.
I will continue to fine tune my programming skill, in the mean time, I will start learning more HTML and C++ in the coming month.