Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About JohnS

  • Rank

Recent Profile Visitors

348 profile views
  1. Yes, it was quite clear, and I thought I understood it. So then why did your Fig.B of Pg.5 execute correctly?
  2. Re: program first.php The program works fine when I enter the URL as: http://localhost/first.php exactly as shown in Fig.A on Pg.4. So far, so good! However, when I open the file using my local path: file:///Applications/MAMP/htdocs/Ch01/first.php it does not execute the HTML, but displays the source code of first.php, but with the <?php ?> tag removed! Fig.B on Pg.5, shows the HTML executing normally (because there is no actual PHP code between the PHP tags). You even say "not that this particular script is affected either way." ​Of course, if I change the name
  3. On p.138 the sphere program is modified. In step 2, he says to change the assignment to: var radius = document.getElementById('radius'); and in step 3, to use: if (radius && (radius.value > 0)) { What is the point of this extra complication? In other words, why not just use the original: var radius = document.getElementById('radius').value; and then simply test for: if (radius > 0) { I've written versions both his way and my way, and they both work the same. I don't understand what he means by: 'The first part of this condition confirms that the radius variable
  4. I got Firebug, and now I can see what was going on. So this problem all stemmed from the use of the “number” type for the Quantity field, which is odd as it was pointed out on p.103, that it was done on purpose. I changed the type to “text” like all the other input fields, and the program behaved the way the book said it should: entering numbers in all the fields gave the correct numerical Total, while entering a string in any of the fields gave ‘NaN’ for the Total. As an experiment I changed the type of all the fields to “number”. It still functions correctly when numbers are entered
  5. For the Chapter 4 shopping example, on p.107: I've got it working when I enter valid numbers, just as in Figure 4.4, but when I enter the string 'cat' in the Quantity field, as you do in Figure 4.5, I get -3.00 in the Total field, not NaN as shown in the book. I realize that the eventual answer is going to be to validate all input before doing any calculations, but I'd still like to know what's going on here, and why my results are not agreeing with the book. Thanks.
  • Create New...