Red de conocimiento informático - Material del sitio web - Después de ingresar un valor en el cuadro desplegable, el valor en el cuadro desplegable aparecerá en el cuadro desplegable ¿Cómo lograr esto?

Después de ingresar un valor en el cuadro desplegable, el valor en el cuadro desplegable aparecerá en el cuadro desplegable ¿Cómo lograr esto?

¿Es este el efecto que deseas?

lt;htmlgt;

lt;headgt;

lt;meta http-equiv="Content-Type" content="text/html; charset= gb2312"gt;

lt.META content="fason, Shin" name=Authorgt;

lt;titlegt;Mensaje dinámico del cuadro desplegablelt;/titlegt;

lt;stylegt;

a{color: rojo; decoración del texto: ninguna; tamaño de fuente: 12px}

lt;/stylegt;

lt;/headgt;

lt;body onload="Init()"gt;

lt;centergt;

lt;h2gt;Dinámico cuadro desplegable de solicitudlt;

lt;hrgt;

lt;form name=frmgt;

lt;tablegt;

lt ;trgt;

lt; tdgt ; Ingrese 1 o 2 o 3 o 4 o 5 para probar: lt; brgt; input name="txt" style="width:onkeyup="SelectTip( 0)" gt; lt; tipo de entrada="botón" valor="reset" onclick="SelectTip(1)"gt; lt; /tdgt;

lt; /trgt;

lt ;trgt;

lt;tdgt;

lt;span id="demo"gt;lt;seleccione nombre="demo" style="ancho: 100px" tamaño =10 onchange ="txt.value=opciones[selectedIndex].text;"gt;

lt;option value="1"gt;/optiongt;

lt; valor de opción = "12"gt;12lt;/optiongt;

lt;valor de opción="123"gt;123lt;/optiongt;

lt;valor de opción="1234" gt;1234lt ;/optiongt;

lt;option value="2"gt;2lt;/optiongt;

lt;option value="23"gt;23lt;/optiongt ;

p>

lt;option value="23"gt;/optiongt;

lt;option value="234"gt;234lt;/optiongt;

lt;opción valor="2345"gt; 2345lt;

lt; opción valor="3"gt; opción valor="34"gt; 34lt;/optiongt;

lt;opción valor="345"gt;/optiongt;

lt;optio

n value="3456"gt;3456lt;/optiongt;

lt;option value="5"gt;5lt;/optiongt;

lt;option value="51" gt;51lt;/optiongt;

lt;option value="51w"gt;51wlt;/optiongt;

lt;option value="51wi"gt; 51wilt;/optiongt;

lt;option value="51win"gt;51winlt;/optiongt;

lt;option value="51windows"gt;51windowslt;/optiongt;

lt;/selectgt;lt;/spangt;

lt;/tdgt;

lt;/trgt;

lt;/ formulario;

lt; /tablegt;

lt;

lt; lenguaje de escritura="javascript"gt; TempArr=[];//opción de tienda

función Init(){

var SelectObj=document.frm.elements["demo"]

/* Primero almacene los datos en la matriz*/

con (SelectObj)

for(i=0;ilt;length;i)TempArr[i]=[options[i]. texto, opciones[i].valor]

}

función SelectTip(bandera){

var TxtObj=document.frm.elements["txtfrm.elements ["txt"]

var SelectObj=document.getElementById("demo")

var Arr=[]

with(SelectObj) {

var SelectHTML=innerHTML.match(/lt;[^gt;]*gt;/)[0]

for(i=0;ilt;TempArr.Si la bandera es verdadera, luego Inicialice el cuadro desplegable

Arr[Arr.length]="lt; option value='" TempArr[i][1] "'gt;" TempArr[i][0] "lt ;/optiongt; "

internalHTML=SelectHTML Arr.join() "lt;/SELECTgt;"

}

}

}

lt;/scriptgt;

lt;/bodygt;