javascript - How to use if statements inside a while loop -


i'm novice @ programming , haven't had luck in finding tutorial useful want do.

i creating form have 2 drop down selections , 1 input box produce price depending on 2 selections.

for first drop down type of event. second selection of adult, child, or student (each selection has own set id). want produce prices dynamically appear in text box based on user's selections sort of following (i'm still figuring out javascript bear me poor example):

while eventid == 2 {     if registration == adult;          price == 45;  } 

any appreciated.

i don't think want loop, think logic looking if statement, in "if registration adult, , event id 2, set price equal 45" so:

if(eventid == 2){     if(registration == 'adult')         price = 45;     if(registration == 'child')         price = 35; } 

depending on want do, there number of combinations of logical structures might employ. switch statement comes mind if have lot of event ids.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -