´ÙÀ½ ÄÚµå´Â ÀÌ·¸½À´Ï´Ù.
°£´ÜÈ÷ ¼³¸íµå·Á¼. Add¹öÆ°À» ´©¸£¸é... list1(text)¿¡ ÀÖ´ø ³»¿ëµéÀÌ list2(select)·Î µé¾î°¡°Ô µË´Ï´Ù..
¹®Á¦´Â submit¹öÆ°À» Ŭ¸¯ÇÏ¿´À»½Ã.. list2ÀÇ ¸ðµç ÀÔ·ÂµÈ ³»¿ëÀ» CGI·Î ³Ñ°ÜÁà¾ßÇϴµ¥..
±×°É ¾î¶»°Ô ÇؾßÇÏ´ÂÁö ¸ð¸£°Ú½À´Ï´Ù..
ÇÑ°¡Áö ¹æ¹ýÀº select multiple ¿¡¼ ¸ðµç Ç׸ñÀ» ¼±ÅÃÇÏ¸é µÇ´Âµ¥..
select´Â ÇÑ°¡Áö¸¸ ¼±ÅõǴ°ɷΠ¾Ë°í ÀÖ½À´Ï´Ù..
´Ù¸¥ ¹æ¹ýÀº list2¸¦ select·Î µÎÁú ¾Ê°í textarea·Î µÎ´Â °Çµ¥..
±×·¸°Ô ÇÏ¸é µÇÁú ¾Ê´õ±º¿ä..
javascript¸¦ ±×³É.. °¡Áö°í ¿Í¼ ¾²´Â°Å¶ó.. Àß µÇÁú ¾Ê½À´Ï´Ù..
Àû´çÇÑ ´äº¯ ºÎŹµå¸³´Ï´Ù. ¹®´ä½ÄÀÇ ´äº¯Àº »ç¾çÇÕ´Ï´Ù..
Á¦ ¼³¸íÀ» ÀÌÇØÇϽǷ±Áö.. ¸ð¸£°Ú³×¿ä..
¾Æ´Ï¸é.. textarea¿¡ µ¥ÀÌÅ͸¦ Ãß°¡ÇÏ°í »èÁ¦ÇÏ´Â ½ºÅ©¸³Å͸¦ Á» ¾Ë·ÁÁÖ¼¼¿ä..
[ÇÁ·Î±×·¥ÄÚµå]
printf("function move(fbox, tbox){ var i = 0; if(fbox.value != \"\") { var no = new Option(); no.value = fbox.value; no.text = fbox.value; tbox.options[tbox.options.length] = no; fbox.value = \"\" ; } }");
printf("function remove(box) {\ for(var i = 0; i < box.options.length; i++) {\ if(box.options[i].selected && box.options[i] != \"\") {\ box.options[i].value = \"\";\ box.options[i].text = \"\";\ }\ }\ BumpUp(box);\ }"); printf("function BumpUp(abox) {\ for(var i = 0; i < abox.options.length; i++) {\ if(abox.options[i].value == \"\") {\ for(var j = i; j < abox.options.length - 1; j++) {\ abox.options[j].value = abox.options[j + 1].value;\ abox.options[j].text = abox.options[j + 1].text;\ }\ var ln = i;\ break;\ }\ }\ if(ln < abox.options.length) {\ abox.options.length -= 1;\ BumpUp(abox);\ }\ }");
printf("function Moveup(dbox) {\ for(var i = 0; i < dbox.options.length; i++) {\ if (dbox.options[i].selected && dbox.options[i] != \"\" && dbox.options[i] != dbox.options[0]) {\ var tmpval = dbox.options[i].value;\ var tmpval2 = dbox.options[i].text;\ dbox.options[i].value = dbox.options[i - 1].value;\ dbox.options[i].text = dbox.options[i - 1].text;\ dbox.options[i-1].value = tmpval;\ dbox.options[i-1].text = tmpval2;\ }\ }\ }");
|
[ÇÁ·Î±×·¥ÄÚµå]
printf("<form name = mode method = get action = mode.cgi>\n"); |
[ÇÁ·Î±×·¥ÄÚµå]
printf("<select multiple size = 2 name = list2>\n"); printf("</select>\n");
|
[ÇÁ·Î±×·¥ÄÚµå]
printf("<input type = text name = list1 value = \"\">\n"); |
[ÇÁ·Î±×·¥ÄÚµå]
printf("<input type = \"button\" value = \"Add\" onclick = \"move(this.form.list1, this.form.list2)\" name = \"B1\">"); printf("<input type = \"button\" value = \"Delete\" onclick = \"remove(this.form.list2)\" name = \"B2\">");
|
[ÇÁ·Î±×·¥ÄÚµå]
printf("<input type = submit value = Apply>\n");
printf("</form>");
|