본문 바로가기

Web/Javascript

코멘트용 js

var    old_menu = '';
    function ShowHide(submenu)
    {
        if(old_menu    != submenu)
        {
            if(    old_menu !='' )
            {
                document.all(submenu).style.display    = 'none';
            }
            document.all(submenu).style.display    = '';
            old_menu = submenu;
        }
        else
        {
            document.all(submenu).style.display    = 'none';
            old_menu = '';
        }
    }

    function CommentRemove(no,form)
    {
        nWin = window.open('/Testing/comment_process.php?psMode=REMOVE&no='+no+'&frm_name='+form,'CommentRemoveWindow','width=100 height=100 top=0');
    }

    function Comment(category, no, d)
    {
        var rnd = Math.round(Math.random()*1000000);
        View = document.createElement("script");
        View.src = '/Testing/comment_process.php?psMode=LIST&nCategoryID='+category+'&no='+no+'&d='+d+'&rnd='+rnd;
        document.body.appendChild(View);
        ShowHide('CommentWrite_'+d);
    }

    function CommentInsert(no, d, category)
    {
        var rnd = Math.round(Math.random()*1000000);
        var content = document.forms['frm_write_'+d].elements['sComment'].value;
        append = '?psMode=WRITE&no='+no+'&content='+content+'&nCategoryID='+category+'&d='+d+'&rnd='+rnd;
        
        View = document.createElement("script");
        View.src = '/Testing/comment_process.php'+append;
        document.body.appendChild(View);
        document.forms['frm_write_'+d].elements['sComment'].value='';
    }

    function CommentDelete(no, delno, d)
    {
        if(confirm('\n삭제하시겠습니까?\n\n삭제를 하시면복구가 불가능합니다.\n'))
        {
            append = '?psMode=REMOVE&no='+no+'&delno='+delno+'&d='+d;

            View = document.createElement("script");
            View.src = '/Testing/comment_process.php'+append;
            document.body.appendChild(View);
        }
    }