Return to Snippet

Revision: 1670
at November 6, 2006 09:33 by pablazo


Initial Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
</head>
<script>
function prueba(){
 
 for (var i = 0; i < document.form.combo.options.length; i++) {  
  if (document.form.combo.options [i].selected && document.form.combo.options[i].value!='')     
   document.write( document.form.combo.options[i].value)
 }
}
</script>
<body>
<form name="form">
 <select name="combo">
  <option value=""></option>
  <option value="a">a</option>
  <option value="b">b</option>
  <option value="c">c</option>
 </select>
 <input type="button" onClick="prueba();">
</form>
</body>
</html>

Initial URL


Initial Description


Initial Title
Comprobar si un combo tiene algún valor seleccionado

Initial Tags
javascript

Initial Language
JavaScript