/    Sign up×
Community /Pin to ProfileBookmark

Gathering information from two form imputs

I have a script that pulls a value from a drop down list, and writes an amount to a text box, depending on the option selected. I need to change it to take into account two values, from two different pull don menus, can I use else/if statements for this? For instance maybe something like this:

if (tbl == “0”) and (reg=”80″)
{ttl.value=”0″};

Complete script follows.

<script langauge=”javascript”>
<!– Hide
function grandtotal()
{
var reg=document.form1.RegType.options[document.form1.RegType.selectedIndex].value;
var tbl=document.form1.DTables.options[document.form1.DTables.selectedIndex].value;
var ttl=document.form1.Total;
if (tbl == “null”)
{ttl.value=”0″};
else if (tbl == “0”)
{ttl.value=”80″};
else if (tbl == “100”)
{ttl.value=”180″};
else if (tbl == “180”)
{ttl.value=”260″};
}
// End Hiding –>
</script>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@WebskaterJan 16.2003 — Your code:

if (tbl == "0") and (reg="80")

{ttl.value="0"};

should read:

if (tbl == "0" && reg="80")

{

ttl.value = "0";

}
Copy linkTweet thisAlerts:
@WebskaterJan 16.2003 — Sorry, slightly wrong.

Your code:

if (tbl == "0") and (reg="80")

{ttl.value="0"};

should read:

if (tbl == "0" && reg=="80")

{

ttl.value = "0";

}

[COLOR=blue]=[/COLOR]
Copy linkTweet thisAlerts:
@AJacobs633authorJan 16.2003 — Thanks
×

Success!

Help @AJacobs633 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.24,
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,
)...