dAivEd Posted July 22, 2009 Report Share Posted July 22, 2009 Čau visiem! Situātcija tāda: lietotājs izvēlas, leja uzreiz saskaita cik tas ir <select name=standart_price> <option value=100>100</option> <option value=200>200</option> <option value=300>300</option> </select> <input type=radio name=15>+15 <input type=radio name=30>+30 <input type=radio name=50>+50 Kopa: ? (selected + input) Nu vot ideja apmēram tāda. Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 22, 2009 Report Share Posted July 22, 2009 dAivEd --> sac ar to ka arii radio butonam noraadi Value.. <input type=radio name="50" value="50">+50 un arii vertiibas jaliek pedinjaas Lai dabuutu tekosho vertiibu izmanto : < select onchange="alert(this.value)" .. Protams alert ir kaa piemers ... Quote Link to comment Share on other sites More sharing options...
cucumber Posted July 22, 2009 Report Share Posted July 22, 2009 (edited) To var izdarit pielietojot javascript selectam onchange uzzinat selecta vertibu var dropdownIndex = document.getElementById('mySelect').selectedIndex; var dropdownValue = document.getElementById('mySelect')[dropdownIndex].value; un radio varetu dabut vertibu var radioValue = document.getElementById(this).value; // ja shis ir onclick Edited July 22, 2009 by cucumber Quote Link to comment Share on other sites More sharing options...
marcis Posted July 22, 2009 Report Share Posted July 22, 2009 cucumber, priekš kam tev document.getElementById(this), ja tev jau ir this objekts? Un select.value strādā tāpat kā select[select.selectedIndex].value :) Un neaizmirstam, ka visas input/select/etc vērtības ir string'i, kas matemātisku darbību gadījumā jāpārvērš par integer'iem - parseInt() Quote Link to comment Share on other sites More sharing options...
cucumber Posted July 22, 2009 Report Share Posted July 22, 2009 ja kluda this.value ar palidz <input type="radio" name="rname" value="15" onclick="alert(this.value);" /> Quote Link to comment Share on other sites More sharing options...
dAivEd Posted July 22, 2009 Author Report Share Posted July 22, 2009 dAivEd --> sac ar to ka arii radio butonam noraadi Value.. <input type=radio name="50" value="50">+50 un arii vertiibas jaliek pedinjaas Lai dabuutu tekosho vertiibu izmanto : < select onchange="alert(this.value)" .. Protams alert ir kaa piemers ... Nu ka tas viss jaliek pediņas utt, to es visu zināju, es uz fikso roku piemēru uzrakstiju, bet ka man tagad šo visu izvadīt ? piemēram tu uzklikšķini visus radio, un leja mainās cipāri Quote Link to comment Share on other sites More sharing options...
cucumber Posted July 22, 2009 Report Share Posted July 22, 2009 O jaa, tu bik latinu esi augstu uzmetis sac no javascript pamatiem http://www.w3schools.com/JS/default.asp Quote Link to comment Share on other sites More sharing options...
dAivEd Posted July 22, 2009 Author Report Share Posted July 22, 2009 omg paldies ka palidzejat ar parasto skriptu kas saskaita :D Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 23, 2009 Report Share Posted July 23, 2009 paldies ka palidzejat ar parasto skriptu kas saskaita :D Tev tachu pateica kaa to visu izdariit, kaa dabuut vertibas utt... primitiivu JS funkciju jau nu iemacies pats uzrakstiit... daudz jau no PHP netskjiras ( ir atskjiribas bet pamats ir taads pats) -- Un kaa sasummet 2 vertiibas jau nu vajadzeetu pasam zinaat, to tomer maaca 1 klasiitee Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.