2010-04-11 3 views
0

다른 Internet Explorer 문제는 ... 여기 JQuery와 이벤트

$("#table_exams tbody tr").click(function() 
{ 
    window.location.hash="#" +$(this).attr("exam_ID"); 
    window.location.href="/medilab/prototypes/exams/edit?examId=" + $(this).attr("exam_ID") +"&referer=" + referer; 

    row_select(this); 
}); 

$("#table_exams tbody tr td a").click(function() 
{ 

    window.location.hash="#" +$(this).parent().parent().attr("exam_ID");   
    var where="/medilab/prototypes/exams/edit?examId=" + $(this).parent().parent().attr("exam_ID") +"&referer=" + referer; 
    window.open(where); 
    row_select($(this).parent().parent()); 
    alert("propaganda"); 
    event.stopPropagation(); 
    event.preventDefault(); 
    return false; 

}); 

문제는이 기능을

$("#table_exams tbody tr td a").click(function() 
{ 

트리거 될 때 다른 기능도 트리거 될 것입니다 내 spaggeti 코드입니다 .... IE에서만 ... 무엇을 할 수 있습니까?

답변

2

이 줄 :

$("#table_exams tbody tr td a").click(function() { 

요구는이 일하기 :

$("#table_exams tbody tr td a").click(function (event) { 

당신은 함수에 적절한 이벤트를 전달하지 않는, 당신이 event.stopPropagation();에 정의되지 않은를 받고있어 상상 것 IE에서.

1

이벤트를 함수에 전달해야합니다. 두 기능 모두에서 변경하십시오 .click(function().click(function (event)

alert(event.isPropagationStopped())을 추가하여 필요한 경우 추가 디버그 할 수 있습니다.

0

event.stopPropagation();은 트릭을해야한다고 생각합니다. jQuery docs을 참조하십시오.

$("#table_exams tbody tr td a").click(function (event) 
{ 
    event.stopPropagation(); 
    window.location.hash="#" +$(this).parent().parent().attr("exam_ID");   
    var where="/medilab/prototypes/exams/edit?examId=" +  $(this).parent().parent().attr("exam_ID") +"&referer=" + referer; 
    window.open(where); 
    row_select($(this).parent().parent()); 
    alert("propaganda"); 
    return false;  
}); 
+1

그는 이미 그걸 가지고 있습니다. 두 번 거기에 있습니다. :) –

+0

고마워, 나는 그 사람을 제거하려고 했어. –