select의 멀티플 속성 응용

4517 단어

function srcToDest(srcid,destid){ 
	     var optionsObjects=document.getElementById(srcid);  
	     var optionsSubObjects=document.getElementById(destid);
	      
	     for(var o=0;o<optionsObjects.length;o++) { 	     	  
		 	if(optionsObjects.options[o].selected==true)  { 
		 	// value text 
			     var optionsvalue=optionsObjects.options[o].value;  
			     var optionstext=optionsObjects.options[o].text; 			     
			     addoptions(destid,optionstext,optionsvalue)  
		      }  
	     }  
       }         
         
       //   
	 function addoptions(objectid,textvalue,optionsvalue){  
		 var optionsSubObjects=document.getElementById(objectid);  
		 var hasexist=0;  
		 for(var o=0;o<optionsSubObjects.length;o++){		 	  
			  var optionsvalue_sub=optionsSubObjects.options[o].text;  
			  if(optionsvalue_sub==textvalue)  hasexist+=1;  
		 } 
		 var  Browser_Name=navigator.appName;
		 
		 
		 if(hasexist==0) {  
		 	//optionsSubObjects.add(new Option(textvalue, optionsvalue)); 
		 	if(Browser_Name=='Netscape'){
		 		optionsSubObjects.add(new Option(textvalue, optionsvalue),null); 
			 }else{
			 	optionsSubObjects.add(new Option(textvalue, optionsvalue));
			 }	 		
		  	
		 } 
		 for(i=0;i<optionsSubObjects.length;i++){  
             optionsSubObjects.options[i].selected=true;  
  		 }
		     
	 } 
   
	 //  
	 function destToSrc(objectid)  {  
	 	var optionsObjects=document.getElementById(objectid);
		 for(var o=0;o<optionsObjects.length;o++)  {  
				 if(optionsObjects.options[o].selected==true)  {  
				    var optionsvalue=optionsObjects.options[o].value;  
				    var optionstext=optionsObjects.options[o].text;  
		       			removeoption(objectid,optionstext,optionsvalue)  
		  		}  
	 	}  
	 }  
   
	 //   
	 function removeoption(objectid,textvalue,optionsvalue)  {  
	 	var optionsSubObjects=document.getElementById(objectid);  
		 for(var o=0;o<optionsSubObjects.length;o++) {  
			  var optionsvalue_sub=optionsSubObjects.options[o].text;  
			  if(optionsvalue_sub==textvalue)  
			        optionsSubObjects.removeChild(optionsSubObjects.options[o]);
		 	}  
	 }  
	 
	 
	 
	 
	      
	     //  js
	      
	      var allcheck=false;
			 function checkall(){   // ( ) 
			  	var all=document.getElementsByTagName("input");
			  	 for(var i=0;i<all.length;i++){
			  			if(all[i].type=="checkbox")	all[i].checked=!allcheck;
			  	 }
			  	allcheck=!allcheck;
			  }

HashMap 페이지에서의 판단

  <td>	
   <select multiple="multiple" size="15" style="width=200px" id="source"> 
		         <option value="1">aaaa</option>  	         
	         	<option value="2">bbbb</option>  	 
	         	<option value="3">cccc</option>  	 
	         	<option value="4">dddd</option>  	 
	        </select>
    	
    	<input type="button" value=" &gt;&gt; "  onclick="javascript:srcToDest('source','target')">     
        <input type="button"  value=" &lt;&lt; " onclick="javascript:destToSrc('target')">  
   		<select multiple="multiple" size="15" style="width=200px" id="target" name="target"></td>


   		<td> </td>
	      <td><input type="checkbox" value=" " onclick="checkall1('os');"/> <br/>
	      	  <c:forEach items="${osList}" var="result" varStatus="recordCount">
	      	  	<input type="checkbox" name="os" value="${result.id}" 	<c:if test="${osMap[result.id]!=null }">checked</c:if> />${result.operationId}
	      	  	<c:if test="${recordCount.count==5}"><br /></c:if>	      	  
	      	  </c:forEach>
	      </td>

좋은 웹페이지 즐겨찾기