Welcome to TalkGraphics.com
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
  1. #11
    Join Date
    Nov 2018
    Posts
    6

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    Nevermind… Definitely my error! Now just have to figure out how to delete the "Calories Burned (English)" option as its not accurate whatsoever... But now I'm rambling! Thank you for your help again, Egg and Acorn (:

  2. #12
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    8,543

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    There are few areas that can be tweaked.

    Your Height is missing its units of feet and inches.

    REE?

    Your responsive view has its fields dimensioned too wide and the Placeholder is not deep enough.

    Entering a weight in lbs and then switching to kgs does not truncate the result so you get a very long, unprofessional, value.

    I don't know why "wt1=wt/2.2"; is less accurate than the value used in "var r2 = (10 * wt*2.2046) + (6.25 * ht) - (5 * a)-161;".

    Have you sorted out filling your r2 field (Calories/day)?

    Acorn
    Last edited by Acorn; 27 November 2018 at 07:43 PM.
    Acorn - My currently active Xara software: occasionally serviced XDPX, purposely unserviced XDPX12 & XDPX11 (32/64-bit), unserviced XWD Premium 15 & 12, XPGD10, X3D7 and lots of 'permanently-owned' licences back through time (to CC's Artworks)

  3. #13
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    8,543

    Info Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    PM
    graphics097, for what it's worth, as a user of such a calculator, I would prefer it to be interactive.

    Calorie Needs Calculator.xar is a widget of sorts that uses Range Sliders as a proof of concept.
    It does not fully work in the Xara Preview so open into your preferred browser.

    It does not do the full calculation (Gender and calories) but it automatically handles metric and imperial measurements.

    It needs CSS styling.

    The HTML is readable and I hope understandable.

    It would be a useful project for any TGer to complete.

    Acorn
    Acorn - My currently active Xara software: occasionally serviced XDPX, purposely unserviced XDPX12 & XDPX11 (32/64-bit), unserviced XWD Premium 15 & 12, XPGD10, X3D7 and lots of 'permanently-owned' licences back through time (to CC's Artworks)

  4. #14
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    18,461

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    I like Acorns range sliders.

    I did a search on Stack Overflow and came up with a very simple form. Weight & Height only.
    Attached Files Attached Files
    Egg

    Intel i7 - 4790K Quad Core + 16GB Ram + 232 GB SSD
    Xara Designer Pro X 16

  5. #15
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    8,543

    Lightbulb Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    I have added the final calculation, probably for a Male.
    The OP needs to advise.

    I have added slider CSS to the page and layout CSS to the Placeholder.

    CSS3 - Calorie Needs Calculator.xar

    Acorn
    Acorn - My currently active Xara software: occasionally serviced XDPX, purposely unserviced XDPX12 & XDPX11 (32/64-bit), unserviced XWD Premium 15 & 12, XPGD10, X3D7 and lots of 'permanently-owned' licences back through time (to CC's Artworks)

  6. #16
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    18,461

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    Like that Acorn, but should the result be a bmi or calories or boyh?

    I like this one as a good example. It tends more towards the British values (I've no idea my height in inches [but I can work this out] but I've no idea of my weight in Pounds, only in Stones & Pounds)

    EXAMPLE
    Egg

    Intel i7 - 4790K Quad Core + 16GB Ram + 232 GB SSD
    Xara Designer Pro X 16

  7. #17
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    8,543

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    Quote Originally Posted by Egg Bramhill View Post
    Like that Acorn, but should the result be a bmi or calories or boyh?
    I like this one as a good example. It tends more towards the British values (I've no idea my height in inches [but I can work this out] but I've no idea of my weight in Pounds, only in Stones & Pounds)
    EXAMPLE
    Sorry Egg, I am not trying to solve a BMI or Calorie calculator, I was pointing out to the OP that sliders, in such cases, are much more valuable as they afford "what if" solutions - " What if I were 5 years younger?" - Age slider - "Gosh, hardly matters!" and so on.

    If I build it fully, someone will come along and ask for the third full stop to be Gothic Red.

    The OP presented kg/lbs and cm/inches. It is not difficult to include st - lbs and ft - inches but in doing so I am probably validating a calculation that may or may not be right, c.f., the original code used 2.2 as a conversion from kg to lbs, which was different elsewhere.

    There are 14 lbs in a stone; 8 stone in a hundredweight and 20 hundredweight in a ton. So I clock in at one hundredweight, one stone and 13 pounds.
    In Germany, I used to get market vegetables in Pfund (pounds) at the time the UK was prosecuting vendors using imperial measures.
    When stuck, most use on-line calculators - "139 pounds in stones and pounds" - https://stonetopounds.com/139-pounds-in-stone.

    Acorn
    Acorn - My currently active Xara software: occasionally serviced XDPX, purposely unserviced XDPX12 & XDPX11 (32/64-bit), unserviced XWD Premium 15 & 12, XPGD10, X3D7 and lots of 'permanently-owned' licences back through time (to CC's Artworks)

  8. #18

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    I don't know if this will be of any help... but I too needed link to a calculator from a site... but just a simple calc...

    I gave up on widgets and coded stuff. Why? Because I'm totally retarded when it comes to such things... so...

    I just did my simple calculator in Excel which allows you to embed it into a site.... took the embed code it provided, put it in a 'placeholder',
    played around with sizes and such... and bam!... there it is!

    Got the job done... Now I'm sure If you're any good at Excel, you can create a pretty sophisticated calculator.

    HERE IT IS...

  9. #19
    Join Date
    Jun 2012
    Location
    CZECH
    Posts
    30

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    cmpan1 - great idea
    The table must be editable online.
    Last edited by Spamiky; 02 December 2018 at 12:50 PM.
    ____________________________
    __I am sorry for my bad English__

    My XARA: P&G 10, 11, 15; XWD Premium 11,15; X PRO 15.1

  10. #20
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    8,543

    Default Re: Incorporating .HTML , .CSS, and .JS into widget to create working calculator

    Quote Originally Posted by cmpan1 View Post
    I don't know if this will be of any help... but I too needed link to a calculator from a site... but just a simple calc...

    I gave up on widgets and coded stuff. Why? Because I'm totally retarded when it comes to such things... so...

    I just did my simple calculator in Excel which allows you to embed it into a site.... took the embed code it provided, put it in a 'placeholder',
    played around with sizes and such... and bam!... there it is!

    Got the job done... Now I'm sure If you're any good at Excel, you can create a pretty sophisticated calculator.

    HERE IT IS...
    It has its place but fails on handling button triggers and radio buttons. In your example, you do need to block entries into the formula fields.

    It does require a properly licensed copy of Excel. The Excel code is horrendous. You need to keep a master Excel version available for changes.

    Google Sheets or Google Forms might be a better start point.

    Acorn
    Acorn - My currently active Xara software: occasionally serviced XDPX, purposely unserviced XDPX12 & XDPX11 (32/64-bit), unserviced XWD Premium 15 & 12, XPGD10, X3D7 and lots of 'permanently-owned' licences back through time (to CC's Artworks)

 

 

Tags for this Thread

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
  •