SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 33 of 33
  1. #26
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    THOSE are the results I expected! Now I'll do some homework and see how to limit the decimals to 2 places. Thanks for your help!
    You can use .toFixed(2) to limit numbers to two decimal places.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #27
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    OK, I figured out where to put your 2-place code. One final thing -- I should be able to enter a number in the ratio box without adding any numbers in the Spur and Pinion boxes at top. But the code won't execute. Any reason why it won't read the top form?

  3. #28
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    OK, I figured out where to put your 2-place code. One final thing -- I should be able to enter a number in the ratio box without adding any numbers in the Spur and Pinion boxes at top. But the code won't execute. Any reason why it won't read the top form?
    Your attached code from earlier plus the fixes seems to work fine in that regrad.

    Show us what you are using now, and we'll find the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #29
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Zipped HTML. Thanks for your time!

    I won't at this station tomorrow. I'll be back in on Friday.
    Attached Files Attached Files

  5. #30
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    OK, I figured out where to put your 2-place code. One final thing -- I should be able to enter a number in the ratio box without adding any numbers in the Spur and Pinion boxes at top. But the code won't execute. Any reason why it won't read the top form?
    The code works for me in Google Chrome when I don't enter the gears and just type in my own ratio number.

    Let's see how it goes in Firefox. That seems to be okay too, although Firebug does provide this warning:

    Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
    Line 144

    That divide.onclick should instead use getElementById

    How about in Internet Explorer? Ahh, that errors saying that divide is not defined.
    Now you know of what should be looked in to.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #31
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I am using this on the iPhone only, so it only needs to work in Safari. If there's no workaround, then we can consider this finished. The people will be very happy to have it as is!

    I really appreciate all your hard work. You are truly a Javascript Guru!

  7. #32
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    I am using this on the iPhone only, so it only needs to work in Safari. If there's no workaround, then we can consider this finished. The people will be very happy to have it as is!
    The Windows version of the Safari web browser doesn't seem to have any trouble either. I'll see if I can find an iphone simulator. Ahh, here's one.
    iBBDemo2 - Cross Platform iPad and iPhone Simulator

    That seems to work too, with your test code that I have up at:
    Gear Ratio

    Quote Originally Posted by StevenHu View Post
    I really appreciate all your hard work. You are truly a Javascript Guru!
    You're very welcome. Thanks.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #33
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I just tried it in Safari on the Mac. Typing a number in either of the top boxes generates "not valid."

    Strange!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •