473,569 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript para enlazar 2 combobox

Hola amigos, necesito realizar un script o algo similar para enlazar
dos combobox. Están insertados en html uno detrás del otro y necesito
que cuando se seleccione una posición del primero, también se marque
automáticamente la misma posición del segundo.

Explicándolo de otra manera: Cuando el usuario seleccione el sexto
option del primer combobox se tendría que seleccionar automáticamente
el sexto option (selected) del segundo combobox.

Un saludo.
Jul 20 '05 #1
2 13259


Guillem wrote:
Hola amigos, necesito realizar un script o algo similar para enlazar
dos combobox. Están insertados en html uno detrás del otro y necesito
que cuando se seleccione una posición del primero, también se marque
automáticamente la misma posición del segundo.

Explicándolo de otra manera: Cuando el usuario seleccione el sexto
option del primer combobox se tendría que seleccionar automáticamente
el sexto option (selected) del segundo combobox.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>settin g the selected option</title>
<script type="text/javascript">
function syncSelects (select1, select2) {
select2.selecte dIndex = select1.selecte dIndex;
}
</script>
</head>
<body>
<form action="">
<select name="select1"
onchange="syncS elects(this, this.form.selec t2);">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<select name="select2">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</form>
</body>
</html>

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Gracias por solucionar problemas a la gente que aún empezamos en esto.

Un saludo.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3205
by: Paul | last post by:
Dear experts, I have a problem with session_start() and JavaScript. In IE6 (but not Mozilla) the first time the page below loads the JavaScript doesn't work (clicking on the graphic should write 'click' in the form entry box). After you hit refresh it works fine. IE doesn't report any error (reporting is turned on). It also works fine if I...
4
2724
by: CB US 77 | last post by:
I use a piece of javascript to create a photo gallery slideshow. The slideshow part works great, but I would like to add captions to each picture. If you want to see the html, send me an email to usb15@cox.net. Any help would be great.
1
6664
by: autogoor | last post by:
Hi, I have a web page for user to input rectangle dimensions, say (10, 10, 100, 40), and then forward the information to a cgi with a url something like http://mydomain.com/cgi-bin/myapp?shape=rectangle&dim=10,10,100,40 But the url generated is http://mydomain.com/cgi-bin/myapp?shape=rectangle&dim=10%2C10%2C100%2C40. How can I fix it?
0
1731
by: Oscar22pr | last post by:
QUIERES GANAR DINERO PARA PAGAR TUS DEUDAS??? GASTE 5 MINUTOS DE SU VIDA EN LEER ESTO Y VERA QUE REALMENTE FUNCIONA. LEGALMENTE!!!!!! !!!IMPRIME ESTA HOJA ...YAAAAAAAAAAA!!! Permíteme empezar diciendo que FINALMENTE LO ENCONTRE !!!. En serio!, lo encontré!. Y eso que odio todos esos ESQUEMAS DE HACERTE RICO RAPIDO!!!. Odio esos esquemas de...
1
2722
by: Oscarin | last post by:
Buenas a todos.. una consulta tengo una aplicacion en asp.net y un funcion en javascript me lee dos text y los multiplica. Ambos text ya estan validados que ingresen solo numeros enteros o con decimal y con punto como separador de decimales.. pero cuando multiplico 23.4 * 1.5 me devuelve 35.099999994 en vez del correcto 35.1 claro que...
0
1786
by: risomarmarques | last post by:
Agora todos os seus sonhos se realizarão! VOCÊ JÁ IMAGINOU GANHAR R$ 30.000,00 EM MENOS DE 4 SEMANAS INVESTINDO APENAS R$ 6,00 - Valor único - não mensal? ACHA IMPOSSÍVEL?? ENTÃO LEIA ESTE ARTIGO E SE SURPREENDA!!! Leia o Texto abaixo ou imprima o mais rápido possível. Aplique apenas 6,00 e ganhe muito dinheiro! Leia todas as dicas abaixo...
1
3022
by: David Roza | last post by:
Groups Home | Help | Sign in Web Images Groups News Froogle Maps more » Advanced Groups Search
0
1934
by: Ranger | last post by:
TRANSFORME R$12,00 EM R$12.000,00 SÓ VAI TOMAR UM POUCO DO SEU TEMPO E VC Ñ VAI SE ARREPENDER ACREDITE!!! LEIA COM ATENÇÃO. MÉTODO APROVADO PELA REVISTA EXAME Você já imaginou ganhar até R$ 12.000,00 ou mais, em pouco tempo? Acha impossível? Leia este artigo e comemore!!! Eu encontrei esta mensagem em um site e decidi tentar. Pouco...
6
2933
by: RamonPV | last post by:
Hello: I am having a problem with to linked comboxes in IE7. Here is my problem that is ONLY ocurring in IE7: I have javascripts functions to populate the second of 2 comboxes given the selected option on the first one; the scripts look to be ok since they work perfectly on firefox 3.08 and also on IE6 and IE8; I have inspected the generated...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.