File: adv_example_result.htm

Recommend this page to a friend!
  Classes of Carlos Falo Hervás  >  linked_select  >  adv_example_result.htm  >  Download  
File: adv_example_result.htm
Role: Sample output
Content type: text/plain
Description: The result of the example execution
Class: linked_select
Multiple dependent (linked) <select> tags
Author: By
Last change:
Date: 19 years ago
Size: 2,421 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title>Untitled</title>
<style type="text/css">
.peque { 
	  font-family: Arial; 
	  font-size: 9px; 
	  color: #000000 
	  }
</style>
<script language="JavaScript">
// Generated by adv_linked_select PHP class

famorder = new Array(3,1,2) ;
fam3val = new Array(5,6);
fam3txt = new Array('pino','roble');
fam1val = new Array(1,2);
fam1txt = new Array('margarita','violeta');
fam2val = new Array(4,3);
fam2txt = new Array('manzana','PERA');

prodorder = new Array(4,1,3,5,6,2) ;
prod4val = new Array(6,7);
prod4txt = new Array('golden','Smith');
prod1val = new Array(2,1);
prod1txt = new Array('amarillus','vulgarios');
prod3val = new Array(5,4);
prod3txt = new Array('de agua','limonera');
prod5val = new Array(1);
prod5val[0]=8 ;
prod5txt = new Array(1);
prod5txt[0]='gallego' ;
prod6val = new Array(1);
prod6val[0]=9 ;
prod6txt = new Array(1);
prod6txt[0]='extremeńo' ;
prod2val = new Array(1);
prod2val[0]=3 ;
prod2txt = new Array(1);
prod2txt[0]='morada' ;

modorder = new Array(2,5,9,8,6,4,3,7,1) ;

/* Select POPULATION functions */

function add(frm,sel,val,txt)
  {
  newopt = document.createElement('OPTION') ;
  newopt.text=txt ;
  newopt.value=val ;
  frm.elements(sel).add(newopt,frm.elements(sel).length)
  }

function empty(frm,sel)
  {
  if (frm.elements(sel).length) {
    var size = frm.elements(sel).length ;
    for (i=size-1;i>0;i--)
      {
      frm.elements(sel).remove(i) ;
      }
    }
  }
function makeselect(frm,sel,dst)
  {
  val = frm.elements[sel].options[frm.elements[sel].selectedIndex].value ;
  if (val!=0)
    {
    eval ("empty(frm,'" + dst + "')") ;	
    for (i=0;i < eval(sel+val+"val.length");i++) {
      eval("add(frm,'"+dst+"',"+sel+val+"val[i],"+sel+val+"txt[i])") ;
      }
    }
  }
	</script></head>

<body>
<form name="test">
<SELECT name="fam" onChange="makeselect(this.form,this.name,'prod');empty(this.form,'mod');empty(this.form,'');"><option value=0>Familia de productos
<OPTION VALUE="3">arboles
<OPTION VALUE="1">flores
<OPTION VALUE="2">frutas
</SELECT><SELECT name="prod" onChange="makeselect(this.form,this.name,'mod');empty(this.form,'');"><option value=0>Productos
</SELECT><SELECT name="mod" onChange="makeselect(this.form,this.name,'');"><option value=0>Modelo
</SELECT></form>
</body>
</html>

For more information send a message to info at phpclasses dot org.