*IF* you make some reasonable attempt at doing your own homework and just need a little help here and there, *THEN* you will almost surely get it. The more work you do, the more likely you are to get *GOOD* help.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
*IF* you make some reasonable attempt at doing your own homework and just need a little help here and there, *THEN* you will almost surely get it. The more work you do, the more likely you are to get *GOOD* help.
This is not homework, I am not in sort of programming class considering im not yet out of high school.
This is something I want to do to help rank anime fighters (I intend to expand so that things like location play a role), and all the knowledge I ahve comes from the Codeacademy tutorial.
You see? The user enters a name (or, better, picks it from a <select> list) and you can find the number of points associated with that name by just doing:
Code:
var points = combatants[ nameUserEntered ];
if ( points == null )
{
... user did not enter a valid name ...
}
Does that get you started?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
You see? The user enters a name (or, better, picks it from a <select> list) and you can find the number of points associated with that name by just doing:
Code:
var points = combatants[ nameUserEntered ];
if ( points == null )
{
... user did not enter a valid name ...
}
You can also get the name that was picked from a <select>, thus:
Code:
var form = document.getElementById("idOfYourForm");
var sel = form.combatant1;
var fighter1Name = sel.options[sel.selectedOption].text;
var fighter1Points = Number(sel.value);
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
SO the same for the other combatant. Get the .value of each <select> and presto! You have the points.
Ok.
The only problem im having is finding a way to call this so when a user puts in combatant 1 and combatant 2, it gives him a message saying combatant 2 wins. I can't figure out how to do it in the submit box from my last code.
The function that you gave me the last time:
function dotranslate( btn )
{
var word = btn.form.translateFrom.value;
btn.form.translateTo.value = dictionary[ word.toLowerCase() ];
}
is very confusing and I can't seem to work it for this one, and get a second box to work.