snach15 Posted July 26, 2010 Report Share Posted July 26, 2010 (edited) kā lai es uztaisu kad piemēram katram value atsevišķi varu piešķirt vērtību .. piemēram value="2" ir 40 un tad kad piemēram paņem otro optionu tad blakus parādas 40 .. <select name="myList" onchange="put()"> <option>Select</option> <option value="2">1</option> <option value="3">5</option> <option value="4">10</option> <option value="5">20</option> <option value="6">50</option> </select> atradu kautko līdzīgu bet kautkas neiet <html> <head> <script type="text/javascript"> function put(){ txt=document.forms[0].myList.options[document.forms[0].myList.selectedIndex].text document.forms[0].favorite.value=txt } </script> </head> <body> <form> Select your favorite browser: <select name="myList" onchange="put()"> <option>Internet Explorer</option> <option>Netscape</option> <option>Opera</option> </select> <br><br> Your favorite browser is: <input type="text" name="favorite" size="20"> </form> </body> </html> Edited July 26, 2010 by snach15 Quote Link to comment Share on other sites More sharing options...
Леший Posted July 26, 2010 Report Share Posted July 26, 2010 Kā var neiet? Parādi visu kodu, kas tev neiet, gan jau kaut kāda muļķīga sintakses kļūda. Quote Link to comment Share on other sites More sharing options...
marcis Posted July 26, 2010 Report Share Posted July 26, 2010 <select name="foo" onchange="put(this.value);"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <span id="bar"></span> <script type="text/javascript"> var values = {1: "2", 2: "4", 3: "6"}; function put(key){ document.getElementById("bar").innerHTML = values[key]; } </script> Quote Link to comment Share on other sites More sharing options...
snach15 Posted July 26, 2010 Author Report Share Posted July 26, 2010 Paldies mārci : darbojas un kā varētu tagad to vērtību izvadīt nevis blakus bet tur kur es viņu gribu? Quote Link to comment Share on other sites More sharing options...
bubu Posted July 26, 2010 Report Share Posted July 26, 2010 span'u ar id="bar" nopozicionē ar css/html līdzekļiem kur vien tik gribi. Tam vairs Javaskriptu nevajag. Quote Link to comment Share on other sites More sharing options...
snach15 Posted July 26, 2010 Author Report Share Posted July 26, 2010 pāldies Quote Link to comment Share on other sites More sharing options...
Kemito Posted July 26, 2010 Report Share Posted July 26, 2010 Var jau pozicionēt ar div`u ar ! :) un CSS failā vai style parametrā norādi visu, ko tev vaig ^^ http://w3schools.com - sadaļā CSS būs krietni paskaidrots! Quote Link to comment Share on other sites More sharing options...
snach15 Posted July 26, 2010 Author Report Share Posted July 26, 2010 (edited) mhh galīg tas javascript man jauc galvu un nevaru pabeigt scriptu .. pirmo reiz viņu pielietoju tāpēc piedošanu par tik daudz jautājumiem .. šobrīd nevaru tikt galā ar to pasu scriptu tik pašām beigām lai notiktu nepieciešamā darbība Kā lai uztaisa tā kad piemēram es izvēlos no visiem tiem optioniem "10" un tas būtu value"3" .. kā lai uztaisa piemēram lai izvēloties šo izvēlni un uzpiežot button Removu notiktu darbība aptuveni šāda mssql_query("UPDATE Datubaze SET punkti = punkti - "saja vietā vajadzētu lai atskaita atiecīgi pēc tā ko izvēlējās (1,5,10,20,50)" WHERE MEMB___ID = '".$_SESSION['user_login_name']."'"); un tad uzreiz vēlviena darbība mssql_query("UPDATE Datubaze SET punkti = punkti - "saja vietā vajadzētu lai atskaita atiecīgi pēc tā ko izvēlējās (10,50,100,200,500)" WHERE MEMB___ID = '".$_SESSION['user_login_name']."'"); <table class="sort-table" width="500" border="0" cellspacing="0" cellpadding="0" align="center"> <thead> <tr> <td width="186" align="center">#</td> <td width="144" align="center">#</td> <td width="170" align="center">#</td> <td width="170" align="center">#</td> </tr> </thead> <tbody> <tr class="'.$tr_color.'"> <td align="center"><? print $_SESSION['user_login_name'] ?></td> <td align="center"><form name="form3" method="post" action=""> <label> <select name="foo" onchange="put(this.value);"> <option value="0">Select</option> <option value="1">1</option> <option value="2">5</option> <option value="3">10</option> <option value="4">20</option> <option value="5">50</option> </select> <script type="text/javascript"> var values = {0: "", 1: "10", 2: "50", 3: "100", 4: "200", 5: "500"}; function put(key){ document.getElementById("bar").innerHTML = values[key]; } </script> <br> </label> </form> </td> <td align="center"><span id="bar"></span></td> <td align="center"><form method="post" action="test-warning.html"> <label> <input type="submit" value="Remove" /> </label> </form></td> </tr> </tbody> </table> <p> </p> Edited July 26, 2010 by snach15 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.