메뉴 건너뛰기

tnt_lang

목록에서 다중 선택된 항목을 표시(특정색상)하고 체크박스를 선택해주는 스크립트

<script language='javascript'>
        // 필요한 만큼 배열설정
        <%
                String curr_pages = request.getParameter("one_page");
        %>


        table_color=new Array();
        table_stats=new Array();

        for(i = 0; i < <%=curr_pages%>; i++) {
                table_stats[i]=0;
        }

        for(i = 0; i < <%=curr_pages%>; i++) {
                table_color[i]='#aaaaff';
        }

        var table_out_color='';
        //이전 색으로 돌림

        var temp=0;

        // 마우스 오버시...
        function m_over(table_obj,table_no) {
          table_obj.style.backgroundColor=table_color[table_no];
        }

        // 테이블 클릭 / 언클릭 상태 저장
        function clicked(table_obj, table_no) {
                var f = document.myform;

                f.checkb[table_no].checked = true;

                temp=table_stats[table_no];
                temp=temp + (temp==0) - (temp==1);
                table_stats[table_no]=temp;

        }

        // 마우스 아웃시
        function m_out(table_obj,table_no) {
                var f = document.myform;
                if (!table_stats[table_no]) {
                        table_obj.style.backgroundColor=table_out_color;
                        f.checkb[table_no].checked = false;
                }
                // 클릭 되어있는지 검사...
        }

        // 테스트 끝
</script>

.......
<table>
          <tr class='trclass05' height='25' style='background-color: <%= (i%2==0) ? "#e2eff2" : "#F5F8FB"%>' onMouseOver=this.style.backgroundColor='#EEEEEE'
          onMouseOut=this.style.backgroundColor=<%= (i%2==0) ? "'#e2eff2'" : "'#F5F8FB'" %> >

                                <td><div align="center">
                                        <input type='checkbox' name='checkb' value='<%=i%>'>

                                        <%-- Key값 --%>
                                        <input type='hidden' name='K1' value='<%=news_id%>'>
                                        <input type='hidden' name='K2' value='<%=new_seq%>'>

                                        <%-- plan_id의 배열값을 임시로 보관 --%>
                                        <input type='hidden' name='plan_id_tmp' value='<%=plan_id%>'>

                             </div></td>
                                <td><div align="center"><%=make_dept_nm%></div></td>
                                <td><div align="center"><%=make_datetime%></div></td>

                                <td align="left" style="cursor:hand"
                                                onMouseOver="m_over(this,<%=i%>)"
                                                onMouseOut="m_out(this,<%=i%>)"        
                                                onClick="javascript:clicked(this, <%=i%>);"
                                                onDblClick="javascript:on_detail(<%=i%>)">
                                        <%=Utility.head(title, 20)%></div></td>
                                <td><div align="center"><%=make_nm%></div></td>
                                <td><div align="center"><%=news_class%></div></td>
                                <td><div align="center"><%=pgm_nm%></div></td>
          </tr>
</table>
위로