2013-06-11 3 views
0

여기에 문제가 있습니다. 모든 친구가있는 사이드 바 및 온라인 상태가 있습니다. 친구를 클릭하면 해당 친구가 바닥 글에 표시되고 채팅 상자가 화면 하단에 나타납니다.Onclick js 함수가 사라짐

채팅 상자 상단에는 이미지가있는 2 개의 버튼이 있습니다. 하나는 최소화하고, 다른 하나는 닫기 버튼입니다. 최소화 버튼을 클릭하면 채팅 상자가 제거되지만 바닥 글에 남아 있습니다. 닫기 버튼을 클릭하면 채팅 상자가 제거되고 바닥 글에서 제거됩니다.

이 모든 벌금과 멋쟁이 작동하지만 내가 최소화 버튼, <button onclick='minimize()'>...</button>을 클릭하고 친구를 reclick 때, 닫기 버튼의 onclick은 비어 있고 작동하지 않습니다 ... 또한 내가 jQuery의 .click 기능을 사용하여 시도했지만하지 않았다 뭐든지해라. 좋아, 난 ... 여기 내 jQuery 코드를 다른 컴퓨터의있어 :

function minimizefcc(){ 
    var current_friend = $("#fcc_container header span").text(); //get current chat window username 
    $("li.fcc_li"+current_friend+"_username").attr('data-activeconnection', 'false'); 
    $("li.friend_li."+current_friend+"_username").attr('data-activeconnection', 'false'); 
    $("#fcc_container").remove();//get rid of chat box(fcc_container = friend chat container) 
} 

function closefcc(){ 
    var current_friend = $("#fcc_container header span").text(); //get current chat window username 
    $("li.fcc_li"+current_friend+"_username").attr('data-activeconnection', 'false'); 
    $("li.friend_li."+current_friend+"_username").attr('data-activeconnection', 'false'); 
    $("#fcc_container").remove();//get rid of chat box(fcc_container = friend chat container) 
    $("li.fcc_li."+current_friend+"_username").remove(); 
    $("li.friend_li."+current_friend+"_username").attr('data-fcopen', 'false'); 
} 

//heres the main code 

$(document).ready(function(){ 
    var friendli = $("li.friend_li"); 
    var footer = $("#footer"); 
    var fccli = $(".fcc_li"); 
    friendli.click(function(){ 
     var username = $(this).attr("data-fcusername"); 
     var open = $(this).attr('data-fcopen'); 
     var active = $(this).attr('data-activeconnection'); 
     if(open === 'false' && active === 'false'){ 
     //friend isn't in footer and isn't in chat box 
     $(this).attr('data-fcopen', 'true'); 
     $(this).attr('data-activeconnection', 'true'); 
     $("#footer #fcc_ul").append("<li class='fcc_li "+username+"_username' data- activeconnection='true' data-fcopen='true' data-fcusername='"+username+"'>"+username+"<img src='you dont need the source' title='status' class='status_img "+username+"_status'/></div>"); 
     minimizefcc(); 
     $("body").append("<div id='fcc_container'><header id='fcc_header'><span>"+username+"</span>"+ 
"<button id='fcc_minimizeButton' onclick='minimizefcc()'><img src='you dont need source...' title='minimize'/></button>"+ 
"<section id='fcc_messageContainer'></section><textarea id='fcc_input'></textarea></div>"); 
     } 

     if(open === 'true'&& active === 'false'){ 
     //friend is in footer but not in chatbox 
     $(this).attr('data-activeconnection', 'true') 
     minimizefcc(); 
     $("body").append("<div id='fcc_container'><header id='fcc_header'>" + 
     "<button id='fcc_minimizeButton' onclick='minimizefcc()'><img src='you dont need source...' title='minimize'/></button>"+ 
     "<section id='fcc_messageContainer'></section><textarea id='fcc_input'></textarea></div>"): 
     $("li.fcc_li."+username+"_username").attr('data-activeconnection', true'); 
    }); 
}); 
+4

Welcome to StackOverflow! 당신이 시도한 것을 보여주는 몇 가지 코드를 게시 할 수 있습니까? 그게 우리가 당신을 도울 수있게 도와 줄 것입니다 : – cfs

+3

오류는 확실히 314 행입니다. 누락 된 괄호가 있습니다. – RelevantUsername

+0

jQuery 코드를 더 많이 게시해야한다. – KyleK

답변

0

이 좋아 내가 그것을 아주 바보 같은 실수였다으로 apoligize 할 ... 두 번째로 좋아하면 내가 잊었 버튼을 추가하는 경우 onclick = 'closefcc()'를 추가하십시오. 그냥 바보 같은 mybad입니다.

+0

걱정하지 않아도, 우리 중 대부분은 수시로 실수를합니다. –

관련 문제