Jump to content
php.lv forumi

<Select> pārnesumi


Mikijs

Recommended Posts

Sveiki, vēlos lūgt Jūsu palīdzību atrisināt 1 porblēmu.

 

Man ir HTML kods

<select name='cat_list' size='10'>
<option value='35'>Pirmais</option>
<option value='72'>Otrais</option>
<option value='26'>Trešais</option>
<optgroup legend='Pārējie'></optgroup>
<option value='3'>Ceturtais</option>
<option value='84'>Piektais</option>
<option value='632'>Sestais</option>
</select>
 
<select name='func_list' size='10'>
</select>

 

Kā lai es dabūnu "ondclick" pārnes no "cat_list" uz "func_list" un otrādi?

Link to comment
Share on other sites

tipa sanāk

 

ja nu kādam vaig

<script>
        function change_listing() {
           var move=document.getElementById("parvietot_no_sejienes").value; // Nosaukums
           var x=document.getElementById("parvietot_no_sejienes"); // Izdzes
           x.remove(x.selectedIndex);
           var y=document.createElement('option');
           y.text=move;
           var x=document.getElementById("parvietot_uz_sejieni"); // Pievieno
           try
             {
             x.add(y,null);
             }
           catch(ex)
             {
             x.add(y); // IE 
             }
        }
     </Script>

Link to comment
Share on other sites

Pārnes to <option> uz kura uzkliko no <select> "cat_list" uz <select> "func_list" un otradi

Diemzel shads variants nestraadas uz Visiem Brauzeriem ...

 

Testiem parbaudi :

IE 6.xx (un nebriinies ka 6.xx Vel sho versiju lieto ~~ 25% useru ...) Skat seit

FF 1.5 (2 ?)

Opera 8.xxx

Safari .... (UZ win tagat arii ir pieejama --> kautgan pagljukaina versija)

------

 

<select> elemnetu Dinamiska pievienosana/ Staraadaa peec principa Varbuut sanaks...

Link to comment
Share on other sites

IE 5 - NEIET

IE 6.xx (un nebriinies ka 6.xx Vel sho versiju lieto ~~ 25% useru ...) Skat seit - NEIET

FF 1.5 (2 ?) - IET

Opera 8.xxx - IET

 

Nja.. ka jau tiko dzirdejam no Gray_Wolf.. ta ir patiesība..

varbūt zināt kadu alternatīvu priekšs IE ?

šobrīd mans kods ir aptuveni šāds

[html]<script>
function change_listing(vars) {
if(vars == 1){
from="to"; /*select lauks 2 */
to="from"; /*select lauks 1 */
}else{
from="from"; /*select lauks 1 */
to="to"; /*select lauks 2 */
}
var move=document.getElementById(from).value;
if(move) {
var distant=new Array();
distant[17] = "hj";
distant[18] = "hjhj";
distant[2] = "Interesantie lāsti";
distant[4] = "Pirmie";
distant[13] = "agas";
distant[19] = "gasga";
distant[14] = "as";
distant[5] = "Otrie";
distant[3] = "Kautkādi lāsti";
distant[15] = "gas";
distant[20] = "gas";
distant[6] = "Trešie";
distant[10] = "bjkjljk";
distant[16] = "te";
distant[7] = "Ceturtie";
distant[21] = "jkhj";
distant[9] = "Un vēl";
distant[22] = "hjhkjhkg";
distant[23] = "ugfiugui";
distant[8] = "Vēl";
distant[24] = "guiguigui";
distant[25] = "guigui";
distant[26] = "guigiu";
distant[27] = "guig";
distant[28] = "igui";
distant[29] = "gui";

var x=document.getElementById(from);
x.remove(x.selectedIndex);
var y=document.createElement('option');
y.text=distant[move];
y.value=move;
var x=document.getElementById(to);
try
{
x.add(y,null);
}
catch(ex)
{
x.add(y); // IE
}
}
}
</Script>
<!--[if IE]>
<script>
function change_listing(vars) {
alert('WTF'+vars);
}
</Script>
<![endif]-->[/html]

Edited by Mikijs
Link to comment
Share on other sites

×
×
  • Create New...