½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > JAVASCRIPT > javascript ¼Ò½ºÃ¢°í > JQuery > Å×ÀÌºí °¡·Î(ROW) ¶óÀÎ À̵¿ »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
Javascript
PHP
ASP
css
html
mysql
jquery
image
API
Mobile
¸Þ´º
slide
°Ô½ÃÆÇ
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
Å×ÀÌºí °¡·Î(ROW) ¶óÀÎ À̵¿
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù JQuery
´Ù¿î·Îµå Ƚ¼ö 918 ȸ
°£´Ü¼³¸í À̵¿ÇÒ °¡·Î ¶óÀÎÀ» ´õºíŬ¸¯ÇÏ¿© È°¼ºÈ­ ÇÑ ÈÄ À̵¿½Ãų °¡·Î¶óÀÎÀ» ´õºíŬ¸¯ÇÏ¿© ÇØ´ç³»¿ëÀ» À̵¿½Ãŵ´Ï´Ù
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
¼Ò½º´Ù¿î·Îµå µ¥¸ð ¹Ì¸®º¸±â ½ºÅ©·¦Çϱâ

Å×ÀÌºí¿¡ <tr></tr>»çÀÌÀÇ <td>µéÀ» µÎ¹øŬ¸¯À¸·Î À§Ä¡¸¦ ¹Ù²Ü¼ö ÀÖ½À´Ï´Ù. tableÀÇ row¿¡ ÇØ´çµÇ´Â ºÎºÐÀ» ÇѲ¨¹ø¿¡ À̵¿½Ãų¼ö ÀÖ´Â ÀÚ¹Ù½ºÅ©¸³Æ®ÀÔ´Ï´Ù.

  1. óÀ½ º¸¿©Áö´Â È­¸éÀÔ´Ï´Ù.
  2. row 0 cell 0 ºÎºÐÀ» ´õºíŬ¸¯ÇÕ´Ï´Ù.
  3. row 3 cell 0¹ø ÀÌ ÀÖ´Â <tr></tr>À» Ŭ¸¯ÇÏ¿© rowºÎºÐ¿¡ ÇØ´çµÇ´Â ºÎºÐÀ¸·Î À̵¿½Ãŵ´Ï´Ù.

º»¿¹Á¦ÀÇ ÀÚ¹Ù½ºÅ©¸³Æ®ÀÔ´Ï´Ù.

<html>
<head>
    <title>ÇØÇÇCGI</title>
<script type='text/javascript' language='JavaScript'>
// Set event handlers ------------
document.ondblclick=onDBLClickHandler;
document.onmouseover=onMouseOverHandler;
document.onmouseout=onMouseOutHandler;

document.onkeypress =
function esc(e)
    {   
    var baseLocation=document.all.mainTable
    document.all.rowId.value="disabled";
   
    if(typeof(e) == "undefined")
    {
    e=event;
    }
    if (e.keyCode == 27)
    {
        for (i=0; i < baseLocation.rows.length; i++)
        {
        baseLocation.rows(i).className='rowOnMouseOut';
        }
    }   
    }
// END ------------

// handler functions ------------
function onDBLClickHandler()
{
    var baseLocation=document.all.mainTable;
    var currentElement=event.srcElement.parentElement;
    var previousID=document.all.rowId.value;
    var presentID=currentElement.getAttribute("id");
   
            //reset rowID and background for clicking outside of table row
            if(currentElement.tagName == "TR" && presentID == "")
                {
                document.all.rowId.value="disabled";
                    for (i=0; i < baseLocation.rows.length; i++)
                        {
                        baseLocation.rows(i).setAttribute("id",i+"r")
                        baseLocation.rows(i).className='rowOnMouseOut';
                        }
                }
            else
                {
                    if(currentElement.tagName == "TR")
                    {
                        if(previousID == "disabled")
                            {
                            // set rowID : set background to "on click" color
                            document.all.rowId.value=presentID;
                            currentElement.className='rowOnDBLClick';
                            }
                        else
                            {
                            //set source row id : strip "r" from id
                            fromID=parseInt(previousID,10)
                           
                            //set target row id : strip "r" from id               
                            toID=parseInt(presentID,10)
                           
                            // move row : clear background : clear rowID from container
                            baseLocation.moveRow(fromID,toID);
                            initTableRows();               
                            }
                    }
                }
}

function onMouseOverHandler()
{
    var baseLocation=document.all.mainTable;   
    var currentElement=event.srcElement.parentElement;
    var presentID=currentElement.getAttribute("id");
   
            if(currentElement.tagName == "TR" && presentID != "")
            {
            baseLocation.rows(presentID).className='rowOnMouseOver';
            }
}

function onMouseOutHandler()
{
    var baseLocation=document.all.mainTable;   
    var currentElement=event.srcElement.parentElement;
    var previousID=document.all.rowId.value;
    var presentID=currentElement.getAttribute("id");
   
            if(currentElement.tagName == "TR" && presentID != "")
            {
                if(presentID != previousID)
                {
                baseLocation.rows(presentID).className='rowOnMouseOut';
                }
                else
                {
                baseLocation.rows(presentID).className='rowOnDBLClick';
                }
            }
}

// END ------------

// set ID's for each row(id=#r) : intialize row styles : row ID container value ------------
function initTableRows()
{
    var baseLocation=document.all.mainTable;
    document.all.rowId.value="disabled";
        for (i=0; i < baseLocation.cells.length; i++)
        {
        baseLocation.cells(i).unselectable = "On";
        }
        for (i=0; i < baseLocation.rows.length; i++)
        {
        baseLocation.rows(i).setAttribute("id",i+"r")
        baseLocation.rows(i).className='rowOnMouseOut';
        }
}
</script>


<style>
.rowOnMouseOver        {background-color:#FFFFFF; cursor:pointer; border:1px solid #000000; text-align:center; color:#000000; font-size:8pt; font-family:Verdana }
.rowOnMouseOut        {background-color:#9DB8E3; cursor:pointer; border:1px solid #000000; text-align:center; color:#000000; font-size:8pt; font-family:Verdana }
.rowOnDBLClick        {background-color:#F2E973; cursor:pointer; border:1px solid #000000; text-align:center; color:#000000; font-size:8pt; font-family:Verdana }
</style>
</head>

<body onload="initTableRows()">
<input type="hidden" id="rowId">

<TABLE id="mainTable" width=400>
<TR>
<TD>row 0 cell 0</TD>
<TD>row 0 cell 1</TD>
<TD>row 0 cell 2</TD>
</TR>
<TR>
<TD>row 1 cell 0</TD>
<TD>row 1 cell 1</TD>
<TD>row 1 cell 2</TD>
</TR>
<TR>
<TD>row 2 cell 0</TD>
<TD>row 2 cell 1</TD>
<TD>row 2 cell 2</TD>
</TR>
<TR>
<TD>row 3 cell 0</TD>
<TD>row 3 cell 1</TD>
<TD>row 3 cell 2</TD>
</TR>
<TR>
<TD>row 4 cell 0</TD>
<TD>row 4 cell 1</TD>
<TD>row 4 cell 2</TD>
</TR>
<TR>
<TD>row 5 cell 0</TD>
<TD>row 5 cell 1</TD>
<TD>row 5 cell 2</TD>
</TR>
</TABLE>


</body>
</html>


³×ƼÁð ÀÇ°ß   ÀÌ¿ëÇϽŠÀÚ·áÀÇ Èı⸦ ÀÚÀ¯·Ó°Ô ÀÛ¼ºÇϼ¼¿ä. (»ó¾÷ÀûÀÎ ±¤°í ¹× µµ¹è¼º ±Û µîÀº »çÀüÅ뺸¾øÀÌ »èÁ¦µÉ ¼ö ÀÖ½À´Ï´Ù.)
³»¿ë ¾ÆÀ̵ð ÀÇ°ß³²±â±â
µî·ÏµÈ ÀÇ°ßÀÌ ¾ø½À´Ï´Ù.
1
À̸§
³»¿ë
:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
µµ¹è¹æÁöÅ°
 51103891 º¸ÀÌ´Â µµ¹è¹æÁöÅ°¸¦ ÀÔ·ÂÇϼ¼¿ä.