連動選択

2160 ワード

1.jspページ

	<scripttype='text/javascript'src='/dwr/interface/Productclass.js'></script>
	<script type='text/javascript' src='/dwr/engine.js'></script>
	<script type='text/javascript' src='/dwr/util.js'></script>
     <script language="javascript">
         setOneClass();
	</script>

//----------------------------------------------
      
<select name="sort1" id="sort1" onclick="setSecondClass(this.value);" >
   <option value="">   </option>
</select>	
<select name="sort2" id="sort2" onclick="setTherdClass(this.value);">
    <option value="">   </option>
</select>		
<select name="sort3" id="sort3">
    <option value="">   </option>
</select>		
2.jsコード

var fectureArray=new Array();
fectureArray=['   '];
////////   /////////
function setOneClass(){
	Productclass.getProductClassByUpId("000000000000000",'4',function(data){
	DWRUtil.removeAllOptions('sort1');
	DWRUtil.addOptions('sort1',fectureArray);
	DWRUtil.addOptions('sort1',data);
	});
	
} 
function setSecondClass(val) { 		 
	Productclass.getProductClassByUpId(val, '4', function(data){
	DWRUtil.removeAllOptions('sort2');
	DWRUtil.addOptions('sort2',fectureArray);
	DWRUtil.addOptions('sort2',data);
	DWRUtil.removeAllOptions('sort3');
	DWRUtil.addOptions('sort3',fectureArray);
	});
} 
function setTherdClass(val) { 
	Productclass.getProductClassByUpId(val, '4',  function(data){
	DWRUtil.removeAllOptions('sort3');
	DWRUtil.addOptions('sort3',fectureArray);
	DWRUtil.addOptions('sort3',data);	
	});
}