|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Aug 2006
Città: The Zone
Messaggi: 21670
|
[HTML/JS] Come richiamare una funzione tramite SELECT ?
//COME NON DETTO, RISOLTO DA SOLO, GRAZIE! ^^
Ok ragazzi il mio è un problema molto semplice.. ma sarà che sono tutto intontito stamattina, ma non riesco a venirne a capo. Ho una select di questo tipo: Codice:
<SELECT> <OPTION VALUE="1"> Scegli</OPTION> <OPTION VALUE="2"> Piano di studi</OPTION> <OPTION VALUE="3"> Esami Superati</OPTION> <OPTION VALUE="4"> Esami da sostenere</OPTION> </SELECT> Codice:
<script> function F1(a) { if (a = 1) alert("1"); if (a = 2) ......etc } </script> <SELECT onChange=F1(this.value)> <OPTION VALUE="1"> Scegli</OPTION> <OPTION VALUE="2"> Piano di studi</OPTION> <OPTION VALUE="3"> Esami Superati</OPTION> <OPTION VALUE="4"> Esami da sostenere</OPTION> </SELECT>
__________________
● ( MyPC ) ● "RimWorld" ● S.T.A.L.K.E.R. 2 ● "The Indie Corner" ●
● "Starfield" ● ..ah nuuu chiiiiki briiiiki iv damke!! ● "Steam Deck" ● ● EA is the Devil... ● ![]() ![]() Ultima modifica di djmatrix619 : 01-02-2011 alle 12:00. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Apr 2002
Città: Palermo
Messaggi: 4913
|
Metti questo codice in un file e dai estenzione .html.
Avevi dimenticato solamente qualche apostrofo e fatto male l'uguaglianza. Ciao Codice:
<html> <head> <script type="text/javascript"> function F1(a) { if (a == 1) alert('1'); if (a == 2) alert('2'); } </script> </head> <body> <SELECT onChange="F1(this.value)"> <OPTION VALUE="1"> Scegli</OPTION> <OPTION VALUE="2"> Piano di studi</OPTION> <OPTION VALUE="3"> Esami Superati</OPTION> <OPTION VALUE="4"> Esami da sostenere</OPTION> </SELECT> </body> </html>
__________________
Sun Certified Java Programmer - Sun Certified Web Component Developer - Sun Certified Business Component Developer |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:03.