Hendrik Bezuidenhout

Greenhorn
+ Follow
since Jul 06, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hendrik Bezuidenhout

Tim Moores wrote:If you want to use getElementById("USD") you need to have an element that has an id of "USD". AFAICT, there is none with that id.

jQuery probably has functions that can retrieve an element that has a data-code-id of "USD", but I don't think JavaScript itself has that.



Is there any other way to do this,
I want to use the second and third lines javascript info, to get the doge/usd to be used in the second javascript, first 2 lines, but it does not work, how van i get it to work.








Bear Bibeault wrote:Meaning that one of your strings doesn't represent a number.

\

All my numbers can be any amount eg 123.12345678 or 1.1232345 or 0.0012234.  All of them is showing, I may do something wrong

Bear Bibeault wrote:A more colloquial solution would be:


Thank you for information, I did try it, but when click on add button, it shows NaN

I am trying to add 4 numbers together, but instead of give it like this   (0.00049358 + 0.13645312 + 0.1000 + .2000 = 0.4369467) but it gives me this result ( 0.000493580.136453120.10000.2000) when i press button, what is wrong with my code

Need help again


I need help with the following.
On MY JAVASCRIPT CODE I need num4 to use the currency automatically for ZAR using USD (1$=14.01 ZAR) using the CURRENCY SCRIPT, but not sure how to do it

MY HTML Code



MY JAVASCRIPT CODE


Currency Script

Campbell Ritchie wrote:I don't know much JS, but try the following two versions. I think the first version is better because there is no repetition of the number literal 0.00001017.Similarly, separate the removal of commas (line 153) from the assignment to num11.



Thank you for your help on this, got it working

Campbell Ritchie wrote:The double = is still difficult to read and understand.



I see , got this from one person that showed me, so i am not sure how to do it in two lines

Stephan van Hulst wrote:

Hendrik Bezuidenhout wrote:

Campbell Ritchie wrote:Why have you got the = assignment operator twice in the same line?



The second = is for the value to be used for part of miltiply


Campbell was really asking a rhetorical question. He means that using multiple assignments in a single statement is poor programming. Instead, split the expression in two separate statements.



I am new to JavaScript, still figuring it out, so there will be bad programing lines,

Stephan van Hulst wrote:Welcome to CodeRanch!

The toLocaleString() function takes an optional 'options' parameter which has a 'maximumFractionDigits' property that defaults to 3.

The operands to your 'test2BTC' multiplication are too small, the answer is rounded to "0.000" which is displayed as "0".

The same problem occurs with your first two multiplications: Notice that the results never have more than 3 fractional digits.

To solve your issue, specify the maximum number of fractional digits you want to display, in the range 0 to 20:



Thank you, got that working

Campbell Ritchie wrote:Why have you got the = assignment operator twice in the same line?



The second = is for the value to be used for part of miltiply

I have html and jave script,
I am doing the following in it.
1. om second column, first line I put in a number
2. Second column give number auto
3 press multiply button to get answer

on second line column 4, I add number, and just press multiply.

The first two is working, but the last two does not work, I have tried to find the problem, but can not see it.

I will change the font info to css, when I get it to work