p4F Posted June 11, 2008 Report Share Posted June 11, 2008 (edited) Sveiki gribēju uzzināt kā ar JS palīdzību var izvadīt selected value. Select iskatās šādi <select id="hosting_tarif" name="hosting_tarif"> <option value="0.49" selected />mini - 25mb - 0,49 Ls</option> <option value="1.39" />start - 100mb - 1,39 Ls</option> <option value="2.39" />middle - 250mb - 2,39 Ls</option> <option value="4.39" />half - 500mb - 4,39 Ls</option> </select> man tas ir vajadzīgs lai piem. function add_time(men,hosting){ if(men == '1'){ akcija = 1; } if(men == '6'){ akcija = 0.9; } if(men == '12'){ akcija = 0.8; } if(men == '24'){ akcija = 0.7; } var cena_now = hosting*men/akcija; document.getElementById('cena').value = cena_now; } </script> <select name="term" id="term" disabled onchange="add_time(this.value,getElementByid('hosting_tarif').value)"> <option value="1" selected="selected">1 месяц</option> <option value="6">6 месяцев (-5% скидка)</option> <option value="12">1 год (-10% скидка)</option> <option value="24">2 года (-20% скидка)</option> </select> <input type="text" id="cena" value="0.00" disabled /> kad izvēlas hostinga_tipu pēctam vajag izvēlēties laiku lai to laiku*hostinga_tipa_cenu Edited June 11, 2008 by p4F Link to comment Share on other sites More sharing options...
andrisp Posted June 11, 2008 Report Share Posted June 11, 2008 gribēju uzzināt kā ar JS palīdzību var izvadīt selected value. Neiedziļinājos tajā kodā, bet http://www.quirksmode.org/js/forms.html#sselect Link to comment Share on other sites More sharing options...
Paulinjsh Posted June 11, 2008 Report Share Posted June 11, 2008 document.getElementById('hosting_tarif').value; Link to comment Share on other sites More sharing options...
Recommended Posts