2011-03-26 1 views
0

지금까지 Linux, OSX 및 Windows의 경우 Chrome, Windows의 경우 IE에서 업로드가 작동하지만 모든 OS에서는 Firefox에서 작동하지 않습니다.첨부 파일 링크에 대한 클릭 이벤트는 Firefox에서 바인딩되지 않습니다.

Allan Jardine의 Visual Event 플러그인을 사용할 때 볼 수있는 첨부 파일 링크에 이벤트가 연결되지 않는 것 같습니다.

그러나 온라인 데모 http://plupload.com/example_custom.php에서 플러그인을 사용하여 click 이벤트에 바인드 된 이벤트를 볼 수 있습니다.

이 경우 Firefox가 실패하는 이유는 무엇입니까?

<form action="/notes" class="new_note" data-remote="true" id="new_note" method="post"> 
    <h3>Create Note</h3> 
    <textarea cols="40" id="note_content" name="note[content]" rows="1"></textarea> 
    <table> 
    <tr> 
     <td id='attachments'> 
     <a href="#" id="attach-files" style="display:none">Add Attachment</a> 
     <a href="#" id="upload-files" style="display:none">Upload Files</a> 
     </td> 
     <td id='button'> 
     <input class="button button-green" disabled="disabled" id="note_submit" name="commit" type="submit" value="Post Note" /> 
     </td> 
    </tr> 
    </table> 
</form> 

자바 스크립트

bind_plupload: function(url) { 
    // plupload setup 
    var uploader = new plupload.Uploader({ 
    runtimes : 'html5,flash,silverlight', 
    browse_button : 'attach-files', 
    container : 'attachments', 
    max_file_size : '2mb', 
    url : url, 
    multipart: true, 
    flash_swf_url : '/javascripts/plugins/plupload/plupload.flash.swf', 
    silverlight_xap_url : '/javascripts/plugins/plupload/plupload.silverlight.xap', 
    filters : [ 
     {title : "Images", extensions : "jpg,gif,png"}, 
     {title : "Documents", extensions : "pdf,doc,docx,odt,txt,xls"} 
    ] 
    }); 

    // push files to server after file is selected 
    if ($.browser.msie) { 
    $("#upload-files").show().click(function() { 
     uploader.start(); 
     return false; 
    }); 
    } 
    else { 
    $("#upload-files").remove() 
    $(":file").live("change", function(e) { 
     uploader.start(); 
    }); 
    } 

    uploader.bind('FilesAdded', function(up, files) { 
    $.each(files, function(i, file) { 
     var msg = sprintf("<div id=\"%s\">%s <b></b></div>", file.id, file.name); 
     $('#attachments').append(msg); 
    }); 
    up.refresh(); // Reposition Flash/Silverlight 
    }); 

    uploader.bind('UploadProgress', function(up, file) { 
    $('#' + file.id + " b").html(file.percent + "%"); 
    }); 

    uploader.bind('Error', function(up, err) { 
    var msg = sprintf("<div>%s%s</div>", err.message, (err.file ? " "+err.file.name : "")) 
    $('#attachments').append(msg); 
    up.refresh(); // Reposition Flash/Silverlight 
    }); 

    uploader.bind('FileUploaded', function(up, file) { 
    $('#' + file.id + " b").html("100%"); 
    }); 

    uploader.init(); 
} // bind plupload 

답변

0

Firefox에서 'attachments'id를 요소에서 새로 중첩 된 태그로 옮겼을 때 효과가있었습니다.

<td> 
    <div id='attachments'> 
     <a href="#" id="attach-files" style="display:none">Add Attachment</a> 
     <a href="#" id="upload-files" style="display:none">Upload Files</a> 
    </div> 
</td> 

이것은 버그로 간주됩니다.

0

ID는 하이픈 포함되어 있지 않습니다.

ID를 attach_files, upload_files 등으로 변경하고 작동하는지 확인하십시오.

Nevermind. (의견보기)

+0

나는 그렇게 확신하지 못합니다. 내가 이것을 작동 시키려고 오랫동안 노력한 이래로 나는 그것을 어쨌든 시도했고 그것이 작동하지 않았다. http://www.w3.org/TR/html401/types.html#type-name – chris

+0

맞습니다. 이것은 몇 년 전의 프로젝트에서 나왔고, 일부 참조 (찾을 수 있었으면 좋겠다.)는 ** ID는 ** 단지 ** 영숫자와 밑줄을 포함 할 수 있다고 말했다. 내 생각 엔'document.idname'이라는 오래된 옛날 상황을 되돌아 보는 것입니다. 하이픈으로 연결된 idname은 분명히 작동하지 않습니다. – awm

관련 문제