멀티플에서 선택하기 (적용 : 메시지보낼때 보낼리스트 선택하기)
페이지 정보
작성자 최고관리자 작성일 21-02-10 17:33 조회 7,327 댓글 0본문
<SCRIPT language=javascript>
function gor(argSel,argRes, txt)
{
formSel=eval("document.reg."+argSel);
j=formSel.length;
for(var i=0;i<document.reg.a.length;i++)
{
if(document.reg.a.options[i].selected && document.reg.a.options[i].value)
{
document.reg.a.options[i].selected=false;
chk_same=0;
for(var k=0; k < j ; k++)
{
if(document.reg.a.options[i].value==formSel.options[k].value)
{
chk_same = 1;
alert("이미 추가된 항목 입니다");
}
}
if(!chk_same)
{
formSel.options[j]=new Option(document.reg.a.options[i].text,document.reg.a.options[i].value);
j++;
}
}
}
get_result(argSel,argRes, txt)
}
function gol(argSel,argRes, txt)
{
formSel=eval("document.reg."+argSel);
buff=new Array();
j=0;
for(var i=formSel.length-1;i>=0;i--)
{
if(formSel.options[i].selected && formSel.options[i].value)
{
formSel.options[i] = null;
}
}
get_result(argSel,argRes, txt);
}
function get_result(argSel,argRes, txt)
{
formSel=eval("document.reg."+argSel);
formRes=eval("document.reg."+argRes);
formtxt=eval("document.reg."+txt);
res=new Array();
res2=new Array();
for(var i=0;i<formSel.length;i++)
{
res[i]=formSel.options[i].value;
res2[i]=formSel.options[i].text;
}
res=res.join("@");
res2=res2.join("@");
formRes.value=res;
formtxt.value=res2;
}
function gou(argSel,argRes, txt)
{
formSel = eval("document.reg."+argSel);
if(!formSel.value)
{
return;
}
thisIndex = formSel.selectedIndex;
if(!thisIndex)
{
return;
}
formSel.value=null;
prevIndex=thisIndex-1;
tempText=formSel.options[prevIndex].text;
tempValue=formSel.options[prevIndex].value;
formSel.options[prevIndex] = new Option(formSel.options[thisIndex].text,formSel.options[thisIndex].value);
formSel.options[thisIndex] = new Option(tempText,tempValue);
formSel.value=formSel.options[prevIndex].value;
get_result(argSel,argRes, txt);
}
function god(argSel,argRes, txt)
{
formSel = eval("document.reg."+argSel);
if(!formSel.value)
{
return;
}
thisIndex = formSel.selectedIndex;
if(thisIndex+1>=formSel.length)
{
return;
}
formSel.value=null;
prevIndex=thisIndex+1;
tempText=formSel.options[prevIndex].text;
tempValue=formSel.options[prevIndex].value;
formSel.options[prevIndex] = new Option(formSel.options[thisIndex].text,formSel.options[thisIndex].value);
formSel.options[thisIndex] = new Option(tempText,tempValue);
formSel.value=formSel.options[prevIndex].value;
get_result(argSel,argRes, txt);
}
</SCRIPT>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<FORM name=reg>
<TBODY>
<TR>
<TD>
<SELECT style="WIDTH: 200px" multiple size=10 name=a ondblclick="javascript:gor('b1','res1','txt1');">
<OPTION value=1>짜장면</OPTION>
<OPTION value=2>짬뽕</OPTION>
<OPTION value=3>볶음밥</OPTION>
<OPTION value=4>라면</OPTION>
<OPTION value=5>김치</OPTION>
<OPTION value=6>단무지</OPTION>
<OPTION value=7>공기밥</OPTION>
<OPTION value=8>김밥</OPTION>
<OPTION value=9>라면밥</OPTION>
<OPTION value=10>백반</OPTION>
</SELECT></TD>
<TD> <INPUT class=button onclick="gor('b1','res1','txt1')" type=button value=" > ">
<BR> <INPUT class=button onclick="gol('b1','res1','txt1')" type=button value=" < ">
</TD>
<TD><SELECT style="WIDTH: 200px" size=10 name=b1 ondblclick="javascript:gol('b1','res1','txt1');"></SELECT> </TD>
<TD> <INPUT class=button onclick="gou('b1','res1','txt1')" type=button value=" ↑ ">
<BR> <INPUT class=button onclick="god('b1','res1','txt1')" type=button value=" ↓ ">
</TD>
</TR>
</TBODY>
</TABLE>
<BR>
결과값
<BR>
<INPUT size=30 name=txt1>
<BR>
<INPUT size=30 name=res1>
</FORM>
----
phpschool.com 에서
function gor(argSel,argRes, txt)
{
formSel=eval("document.reg."+argSel);
j=formSel.length;
for(var i=0;i<document.reg.a.length;i++)
{
if(document.reg.a.options[i].selected && document.reg.a.options[i].value)
{
document.reg.a.options[i].selected=false;
chk_same=0;
for(var k=0; k < j ; k++)
{
if(document.reg.a.options[i].value==formSel.options[k].value)
{
chk_same = 1;
alert("이미 추가된 항목 입니다");
}
}
if(!chk_same)
{
formSel.options[j]=new Option(document.reg.a.options[i].text,document.reg.a.options[i].value);
j++;
}
}
}
get_result(argSel,argRes, txt)
}
function gol(argSel,argRes, txt)
{
formSel=eval("document.reg."+argSel);
buff=new Array();
j=0;
for(var i=formSel.length-1;i>=0;i--)
{
if(formSel.options[i].selected && formSel.options[i].value)
{
formSel.options[i] = null;
}
}
get_result(argSel,argRes, txt);
}
function get_result(argSel,argRes, txt)
{
formSel=eval("document.reg."+argSel);
formRes=eval("document.reg."+argRes);
formtxt=eval("document.reg."+txt);
res=new Array();
res2=new Array();
for(var i=0;i<formSel.length;i++)
{
res[i]=formSel.options[i].value;
res2[i]=formSel.options[i].text;
}
res=res.join("@");
res2=res2.join("@");
formRes.value=res;
formtxt.value=res2;
}
function gou(argSel,argRes, txt)
{
formSel = eval("document.reg."+argSel);
if(!formSel.value)
{
return;
}
thisIndex = formSel.selectedIndex;
if(!thisIndex)
{
return;
}
formSel.value=null;
prevIndex=thisIndex-1;
tempText=formSel.options[prevIndex].text;
tempValue=formSel.options[prevIndex].value;
formSel.options[prevIndex] = new Option(formSel.options[thisIndex].text,formSel.options[thisIndex].value);
formSel.options[thisIndex] = new Option(tempText,tempValue);
formSel.value=formSel.options[prevIndex].value;
get_result(argSel,argRes, txt);
}
function god(argSel,argRes, txt)
{
formSel = eval("document.reg."+argSel);
if(!formSel.value)
{
return;
}
thisIndex = formSel.selectedIndex;
if(thisIndex+1>=formSel.length)
{
return;
}
formSel.value=null;
prevIndex=thisIndex+1;
tempText=formSel.options[prevIndex].text;
tempValue=formSel.options[prevIndex].value;
formSel.options[prevIndex] = new Option(formSel.options[thisIndex].text,formSel.options[thisIndex].value);
formSel.options[thisIndex] = new Option(tempText,tempValue);
formSel.value=formSel.options[prevIndex].value;
get_result(argSel,argRes, txt);
}
</SCRIPT>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<FORM name=reg>
<TBODY>
<TR>
<TD>
<SELECT style="WIDTH: 200px" multiple size=10 name=a ondblclick="javascript:gor('b1','res1','txt1');">
<OPTION value=1>짜장면</OPTION>
<OPTION value=2>짬뽕</OPTION>
<OPTION value=3>볶음밥</OPTION>
<OPTION value=4>라면</OPTION>
<OPTION value=5>김치</OPTION>
<OPTION value=6>단무지</OPTION>
<OPTION value=7>공기밥</OPTION>
<OPTION value=8>김밥</OPTION>
<OPTION value=9>라면밥</OPTION>
<OPTION value=10>백반</OPTION>
</SELECT></TD>
<TD> <INPUT class=button onclick="gor('b1','res1','txt1')" type=button value=" > ">
<BR> <INPUT class=button onclick="gol('b1','res1','txt1')" type=button value=" < ">
</TD>
<TD><SELECT style="WIDTH: 200px" size=10 name=b1 ondblclick="javascript:gol('b1','res1','txt1');"></SELECT> </TD>
<TD> <INPUT class=button onclick="gou('b1','res1','txt1')" type=button value=" ↑ ">
<BR> <INPUT class=button onclick="god('b1','res1','txt1')" type=button value=" ↓ ">
</TD>
</TR>
</TBODY>
</TABLE>
<BR>
결과값
<BR>
<INPUT size=30 name=txt1>
<BR>
<INPUT size=30 name=res1>
</FORM>
----
phpschool.com 에서
댓글목록 0
등록된 댓글이 없습니다.