snach15 Posted May 1, 2011 Report Share Posted May 1, 2011 (edited) sveiki, varētu lūdzu pateikt kur esmu pieļāvis kļūdu? kods nearbojas ... <script type="text/javascript"> function premiumacc(type) { document.getElementById("premium").style.display = "none" document.getElementById("goldmember").style.display = "none" document.getElementById(type).style.display = "" } </script> <select name="premiumpack" onchange="put(this.value);"> <option value="free" onclick="premiumacc('free')">Select</option> <option value="premium" onclick="premiumacc('premium')">Premium</option> <option value="goldmember" onclick="premiumacc('goldmember')">Goldmember</option> </select> <span id=premium style=display:none>test1</span> <span id=goldmember style=display:none>test2</span> Edited May 1, 2011 by snach15 Quote Link to comment Share on other sites More sharing options...
m8t Posted May 1, 2011 Report Share Posted May 1, 2011 (edited) document.getElementById("premium").style.display = "none" document.getElementById("goldmember").style.display = "none" document.getElementById(type).style.display = "" Kur pazuduši " ; " simboli? Arī šī ir kļūda. Nevalidēsies bez "". <span id=premium style=display:none>test1</span> <span id=goldmember style=display:none>test2</span> Edited May 1, 2011 by m8t Quote Link to comment Share on other sites More sharing options...
e-remit Posted May 1, 2011 Report Share Posted May 1, 2011 1) moš paprovē pēdiņas palietot: <span id="premium" style="display:none">test1</span> <span id="goldmember" style="display:none">test2</span> 2) "put" nav definēts: <select name="premiumpack" onchange="put(this.value);"> ieslēdz firebug un ieraudzīsi konsolē... Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted May 1, 2011 Report Share Posted May 1, 2011 (edited) 1. kart ko nozimee nedarbojaas? kads ir kljudas pazinjojums? 2. kur funkcija put() ?? 3. kur ir dotajai rindinjai ID ? document.getElementById(type).style.display = "" tu tachu megjini noslept <option> elementu... tad vismaz iedali vinjam ID .. 4. tas kods ir apsaluuti bezjedziigs, jo nedara pilnigi neko.. vismaz ar dotajam vertibam paskaties pats: ja ari funkcija veiksmiigi nostradaatu tad 1 rindinja noslepj spanu test 1, kas jau tapat ir noslepts 2 rindinja izdara to pashu ar test2 3 rindinja atjauno defolto vertibu konkretam optionam (kuru protams nevar atrast, jo nav id) Edited May 1, 2011 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
snach15 Posted May 1, 2011 Author Report Share Posted May 1, 2011 bišk saputrojos ... paldies bet tagad ir šada lieta atkal kad izvēlos kādu no iptioniem man uzreiz parāda test1 test2 <script type="text/javascript"> function premiumacc(type) { document.getElementById("premium").style.display = ""; document.getElementById("goldmember").style.display = ""; } </script> <select name="premiumpack" onchange="premiumacc(type);"> <option value="free" onclick="premiumacc('free')">Select</option> <option value="premium" onclick="premiumacc('premium')">Premium</option> <option value="goldmember" onclick="premiumacc('goldmember')">Goldmember</option> </select> <span id="premium" style="display:none">test1</span> <span id="goldmember" style="display:none">test2</span> Quote Link to comment Share on other sites More sharing options...
e-remit Posted May 1, 2011 Report Share Posted May 1, 2011 a ko tu citu gribēji ieraudzīt, ja viens aiz otra uzrakstīts: document.getElementById("premium").style.display = ""; document.getElementById("goldmember").style.display = ""; un kāpēc tu premiumacc() sauc gan no onchange, gan no onclick? Quote Link to comment Share on other sites More sharing options...
snach15 Posted May 1, 2011 Author Report Share Posted May 1, 2011 1.tagad galīgi nesapratu ... kā tad lai viņus uzraksta? 2.onclick jav itkā nesaucu neko .. Quote Link to comment Share on other sites More sharing options...
e-remit Posted May 1, 2011 Report Share Posted May 1, 2011 Nav īsti smuki, bet tavai saprašanai tā derēs. pārējo, ask google: <script type="text/javascript"> function premiumacc(type) { document.getElementById("premium").style.display = type.value == "premium" ? "" : "none"; document.getElementById("goldmember").style.display = type.value == "goldmember" ? "" : "none"; } </script> <select name="premiumpack" onchange="premiumacc(this);"> <option value="free">Select</option> <option value="premium">Premium</option> <option value="goldmember">Goldmember</option> </select> <span id="premium" style="display:none">test1</span> <span id="goldmember" style="display:none">test2</span> P.S. optimizētājus lūc nebļaut - pats zinu, ka neveikli, bet nu cilvēkam saprotamāk... Quote Link to comment Share on other sites More sharing options...
snach15 Posted May 1, 2011 Author Report Share Posted May 1, 2011 paldies 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.