codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
<html>
<head>
<title>test</title> 
<script type="text/javascript">
function ComponiFrase(){
var indumento = document.getElementById('indumento').options[document.getElementById('indumento').selectedIndex].value
var color = document.getElementById('colore').options[document.getElementById('colore').selectedIndex].value
var capo = (indumento.substr(indumento.length-1) == "e" || indumento.substr(indumento.length-1) == "o")? color : color.replace(color.substr(0,color.length),color.substr(0,color.length-1)+'a');
var periodo = document.getElementById('stagione').options[document.getElementById('stagione').selectedIndex].value
if(indumento == 0 || color == 0 || periodo == 0){
var ind = (indumento == 0)? "indumento " : "";
var col = (color == 0 ) ? " colore " : "";
var per = (periodo == 0)? " periodo" : "";
alert("Selezionare "+ind+col+per);
}else{
var Frase = indumento +" "+ capo +" "+ periodo
document.getElementById('frase').innerHTML = Frase
}}
</script>
<style type="text/css">
<!--
.Stile1 {
	border: 1px solid #CCCCCC;
}
.Stile2 {
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
}
.Stile3 {
	font-size: 12;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<form action="" method="post" name="f2">
  


  
  <table width="100%" border="0">
    <tr>
      <td bgcolor="#333300"><div align="center" class="Stile2">Indumento</div></td>
      <td bgcolor="#660066"><div align="center" class="Stile2">Colore</div></td>
      <td bgcolor="#000066"><div align="center" class="Stile2">Stagione</div></td>
    </tr>
    <tr>
      <td bgcolor="#333300">
        <select name="indumento" id="indumento" onchange="document.getElementById('frase').innerHTML=''" >
          <option value="0" selected>(selezionare una voce)</option>
          <option value="Camicia">Camicia</option>
          <option value="Maglietta">Maglietta</option>
          <option value="Pantalone">Pantolone</option>
          </select>
      </td>
      <td bgcolor="#660066"><select name="colore" id="colore" onchange="document.getElementById('frase').innerHTML=''" >
        <option value="0" selected>(selezionare una voce)</option>
        <option value="nero">Nero</option>
        <option value="grigio">Grigio</option>
        <option value="rosso">Rosso</option>
      </select></td>
      <td bgcolor="#000066"><select name="stagione" id="stagione" onchange="document.getElementById('frase').innerHTML=''" >
        <option value="0" selected="selected">(selezionare una voce)</option>
        <option value="di lino">estate</option>
        <option value="di cotone">primavera</option>
        <option value="di lana">inverno</option>
      </select></td>
    </tr>
    <tr>
      <td>
        <input type="button" name="but" id="but" value="Componi" onclick="ComponiFrase()"  />      </td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td colspan="3" class="Stile1">
      <div align="center">Frase</div>
      </td>
    </tr>
    <tr>
      <td colspan="3" class="Stile1" id="frase"></td>
    </tr>
  </table>
</form>
</body>
</html>