Ir para conteúdo
Fórum Script Brasil
  • 0

menu dinamico com redirecionamento para url


princesa

Pergunta

Olá Pessoal,

Por favor eu tenho o seguinte código para criar um jump menu dinamico, mas gostaria que quando o item da segunda janela fosse selecionado automaticamente fosse direcionado para uma url..o q devo mudar no código?

Grata

<html>
<head><title>Javascript Dynamic ListBox Demonstration</title>
</head>
<body bgcolor="#ffffff" OnLoad="setOption(document.ThisForm, 0)">
<blockquote>
<form name="ThisForm">
<!--
The listbox size should be same as the list which has the maximum size.
i.e. The number of "<option>" = the size of the maximum list.
//-->
<select name="List1" OnChange="setOption(this.form, this.selectedIndex)">
<option>Animals
<option>Colours
<option>Numbers
<option>Places
</select><p>
<select name="List2" OnChange="this.form.ValueIn2.value=this.options[this.selectedIndex].value">
<option>
<option>
<option>
<option>
<option>
<option>
<option>_________________
</select>
</form>
&lt;script language="javascript">
<!--
function setOption(form, index) {
for (var i = 0; i < form.List2.length; i++) {
form.List2.options[i].text = "";
form.List2.options[i].value = "";
}
if (index == 0) {
form.List2.options[0].text = "Cat";
form.List2.options[0].value = "verdade"
form.List2.options[1].text = "Lion";
form.List2.options[1].value = "ani1";
form.List2.options[2].text = "Tiger";
form.List2.options[2].value = "ani2";
form.List2.options[3].text = "Dog";
form.List2.options[3].value = "ani3";
form.List2.options[4].text = "Cow";
form.List2.options[4].value = "ani4";
form.List2.options[5].text = "Snake";
form.List2.options[5].value = "ani5";
form.List2.options[6].text = "Monkey";
form.List2.options[6].value = "ani6";
}
else if (index == 1) {
form.List2.options[0].text = "Blue";
form.List2.options[0].value = "col0";
form.List2.options[1].text = "Red";
form.List2.options[1].value = "col1";
form.List2.options[2].text = "Yellow";
form.List2.options[2].value = "col2";
form.List2.options[3].text = "Green";
form.List2.options[3].value = "col3";
form.List2.options[4].text = "Orange";
form.List2.options[4].value = "col4";
}
else if (index == 2) {
form.List2.options[0].text = "One";
form.List2.options[0].value = "num0";
form.List2.options[1].text = "Two";
form.List2.options[1].value = "num1";
form.List2.options[2].text = "Three";
form.List2.options[2].value = "num2";
form.List2.options[3].text = "Four";
form.List2.options[3].value = "num3";
form.List2.options[4].text = "Five";
form.List2.options[4].value = "num4";
}
else if (index == 3) {
form.List2.options[0].text = "Airport";
form.List2.options[0].value = "pla0";
form.List2.options[1].text = "Railway Station";
form.List2.options[1].value = "pla1";
form.List2.options[2].text = "Museum";
form.List2.options[2].value = "pla2";
form.List2.options[3].text = "Stadium";
form.List2.options[3].value = "pla3";
}
form.List2.selectedIndex = 0;
form.ValueIn2.value = form.List2.options[form.List2.selectedIndex].value;
}
//-->
</script>
</blockquote>
<p>
<center>
</center>
</body>
</html>
[/codebox]

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...