Function1 calls showCyclists() by calling, at the end of function1, using a parameter, showCyclists(country.id). This launches the showCylists function.
function showCyclists(countryID){ //creates a table with athlete of country
function cyclistOrder() { //checks on change select box and appends to sort
sql="SELECT name, ISO_id, height, weight, gender FROM `Cyclist`"; //get info from cyclist db
select = document.getElementById("selectCycle")
if(select.value == "height"){
sql += " ORDER BY height ";
}
return sql;
}
//continue with showCyclists()
I need to find a way to execute this function with the same parameter (country id) on change of a select box.
Obviously I can't do <select id="selectCycle" class="select-cycle" onchange="showCyclists()"> because I'd be calling my function with no parameter.
How can I solve this? Thanks in advance
onchange="showCyclists(value)"function1, but if it wraps the other, you can just use closure to reach the parameter...