Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Pegar falor do Select pelo onChange


Sérgio Murillo

Question

Gostaria de pegar o valor dos Options de um Select ... alguém sabe como posso fazer isso ?

<select name = 'func' onChange = "SelectFunc()">
                             <option value = '1'>Todas</option>
                             <option value = 'Adido'>Adido</option>
                             <option value = '1'>Adj. de Adido</option
                             
                         </select>
function SelectFunc(){
             var func = document.getElementsByName("func");    
             
             alert(func);
             
             if (func == "Adido"){
                 $('#func').fadeIn(2000);
             }
         }

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

olha um exemplo ae

function envia_url(valor,local){
    document.getElementById(local).src = valor;
}
<select name="sl1" onChange="java script: envia_url(this.value,'j1');">
<option value="" selected="selected">escolha</option>
<option value="http://www.google.com">google</option>
<option value="http://www.corinthians.com.br">corinthinas</option>
</select>
<br />
<iframe id="j1" height="200px" width="800px" frameborder="1" scrolling="auto" noresize="0" name="janela"></iframe>

Link to comment
Share on other sites

  • 0
olha um exemplo ae

function envia_url(valor,local){
     document.getElementById(local).src = valor;
 }
<select name="sl1" onChange="java script: envia_url(this.value,'j1');">
 <option value="" selected="selected">escolha</option>
 <option value="http://www.google.com">google</option>
 <option value="http://www.corinthians.com.br">corinthinas</option>
 </select>
 <br />
 <iframe id="j1" height="200px" width="800px" frameborder="1" scrolling="auto" noresize="0" name="janela"></iframe>

Muito obrigado fercosmig.

Com seu exemplo consegui resolver meu problema.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...