Adatta questo alle tue esigenze
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento senza titolo</title> <script type="text/javascript"> function Mostra(option){ if (option.options[option.selectedIndex].value == 1){noattivo = "hidden"; attivo = "visible"; document.getElementById('costo1').style.visibility=attivo; document.getElementById('prezzo1').style.visibility=noattivo;} else if (option.options[option.selectedIndex].value == 2){noattivo = "hidden"; attivo = "visible"; document.getElementById('costo1').style.visibility=noattivo; document.getElementById('prezzo1').style.visibility=attivo;} else{ document.getElementById('costo1').style.visibility="hidden"; document.getElementById('prezzo1').style.visibility="hidden"; }} </script> <style type="text/css"> div#prezzo1{visibility:hidden} div#costo1{visibility:hidden} </style> </head> <body> <select name="resaImpianto" class="select" id="resaImpianto" onchange="Mostra(this)"> <option value="0" selected="selected">selezionare</option> <option value="1">risparmio in bolletta</option> <option value="2">vendita energia prodotta</option> </select> <div id="costo1">Inserire qui il contenuto per id "costo1"</div> <div id="prezzo1">Inserire qui il contenuto per id "prezzo1"</div> </body> </html>![]()

Rispondi quotando