/    Sign up×
Community /Pin to ProfileBookmark

What’s the function of this this formula?

What’s the function of the below? ;

Any inputs on “GRT”, depends on the number of the unit(1, 2, 3 etc..), the results shows on “Amount”.

Link ->[url]http://www.oceanbulk.com.sg/mat.html[/url]

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@HaganeNoKokoroJul 26.2004 — well, for starters, the field for unit probably needs an id before we can use its value. I am going to pretend that its id='unit'

document.getElementById('amount1').value=Number(document.getElementById('a'))*Number(document.getElementById('unit'));

assuming, of course, you want the product of the two values.

this should go in your calcValue function (probably instead of setting amount1's value to (a's value*0))
Copy linkTweet thisAlerts:
@oceanmaidauthorJul 26.2004 — After I did the changes as above, it's not working...?
Copy linkTweet thisAlerts:
@HaganeNoKokoroJul 26.2004 — there is still a line, later in your calcValue() function:

document.getElementById('amount1').value = Number(getEl('a').value) * 0;

remove it because it is setting the value of amount1 to 0 no matter what.

oh, and oops the code i should have given you before was:

document.getElementById('amount1').value=Number(document.getElementById('a').value)*Number(document.getElementById('unit').value);
Copy linkTweet thisAlerts:
@oceanmaidauthorJul 26.2004 — Could you insert for me the functions and send me the entire script?

Gee, thanks..?

BTW, how could it be like the below? ;

document.getElementById('amount1').value = Number(getEl('a').value) * 0;

Isn't anything times 0=0

Man, this is so confusing...Plase help..
Copy linkTweet thisAlerts:
@HaganeNoKokoroJul 26.2004 — <i>
</i>function calcValue(){
document.getElementById('j').value = Number(getEl('a').value) / 100 * 2.2;

/* This is the line I added */
document.getElementById('amount1').value=Number(document.getElementById('a').value)*Number(document.getElementById('unit').value);

dues=document.getElementById('k');
val=Number(getEl('a').value);
if(val&gt;40000)dues.value=175
else if(val&gt;20000)dues.value=140
else if(val&gt;10000)dues.value=105
else if(val&gt;5000)dues.value=80
else if(val&gt;2000)dues.value=60
else if(val&gt;1000)dues.value=40
else if(val&gt;75)dues.value=25
else if(val&lt;=75)dues.value=0//do not know, if you need this

/* this is the line i removed */
//document.getElementById('amount1').value = Number(getEl('a').value) * 0;

document.getElementById('total').value = Number(getEl('b').value) + Number(getEl('c').value) + Number(getEl('d').value) + Number(getEl('e').value) + Number(getEl('f').value) + Number(getEl('g').value) + Number(getEl('g').value) + Number(getEl('i').value) + Number(getEl('j').value) + Number(getEl('k').value) + Number(getEl('l').value);
}


the line:

document.getElementById('amount1').value = Number(getEl('a').value) * 0;

was already in your original code, that's why i said remove it
Copy linkTweet thisAlerts:
@HaganeNoKokoroJul 26.2004 — I think I found it!

you have a line:

bindEvents(getEl('a'), getEl('b'), getEl('c'), getEl('d'), getEl('e'), getEl('f'), getEl('g'), getEl('h'), getEl('i'), getEl('j'), getEl('k'), getEl('l'));

change it to:

bindEvents(getEl('a'), getEl('b'), getEl('c'), getEl('d'), getEl('e'), getEl('f'), getEl('g'), getEl('h'), getEl('i'), getEl('j'), getEl('k'), getEl('l'), getEl('unit'));

sorry it took so long to figure out, i'm used to handling events a little differently.
Copy linkTweet thisAlerts:
@oceanmaidauthorJul 26.2004 — [SIZE=4]Domo Arigato Gozaimasu, HaganeNoKokoro-san!!![/SIZE]
×

Success!

Help @oceanmaid spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...