제 스크립트가 파이어 폭스와 크롬에서 잘 작동하는 것 같지만 ie8에서는 실패한 것 같습니다. Stragely 나는 스크립트의 모든 코드와 경고 기능이 작동하기 전에 경고 기능을 배치했습니다. document.ready 함수는 거의 실행되지 않습니다. 이것이 ie8 문제입니까? 그렇다면 어떻게이 문제를 해결할 수 있습니까? 도와주세요.jquery 스크립트가 크롬에서는 정상적으로 작동하지만 ie8이 아닙니다.
코드 :
<script src="/_layouts/topsoe.common/js/jquery-1.10.2.min.js?rev=YoBy5yEtsejNrLIrIXUs2g%3D%3D" type="text/javascript"></script>
<script>
$(document).ready(function() {
// hide the last two columns and their headings
$("#WebPartWPQ3 .ms-vh2:eq(5)").css("display", "none"); // for the last two column headings;
$("#WebPartWPQ3 .ms-vh2:eq(4)").css("display", "none");
// for each row in the application page
var idcount = 0;
$("#WebPartWPQ3 .ms-itmhover").each(function() {
var proj_ID='project' + idcount; // assigning each row an id so that they can be accesed individually
$(this).attr('id', 'project' + idcount);
idcount = idcount + 1;
$("#"+proj_ID+" .ms-vb2:eq(5)").css("display", "none");
$("#"+proj_ID+" .ms-vb2:eq(4)").css("display", "none");
// extracting the project status and the precentage of completion. these will be used to assign color codes
var status = $("#"+proj_ID+" .ms-vb2:eq(3)").html();
var percentage = $("#" + proj_ID + " .ms-vb2:eq(5) div").html();
var suffix = percentage.match(/\d+/);
console.log(proj_ID + "\n" + status + "\n" + percentage); // remove after testing
// formatting the status cell accroding to the status and percentage;
var bg_color; var status_formatted;
if (status == "In Progress") {
$("#" + proj_ID + " .ms-vb2:eq(3)").html("<div style='position:relative; width:" + suffix + "%;background:#44AFF6; z-index:0; height:60px; margin-bottom:-50px;'></div><div style='position:relative; z-index:1; text-align:center; margin-left:2px;' >In Progress</br>" + percentage + "</div>");
}
if (status == "Completed") {
$("#" + proj_ID + " .ms-vb2:eq(3)").html("<div style='position:relative; width:100% ;background:#57C759; z-index:0; padding:20px 2px; coor:black; height:23px; text-align:center'>completed</div>");
}
if (status == "Halted") {
$("#" + proj_ID + " .ms-vb2:eq(3)").html("<div style='position:relative; width:" + suffix + "%;background:#FF0033; z-index:0; height:60px; margin-bottom:-50px;'></div><div style='position:relative; z-index:1; text-align:center; margin-left:2px;' >Halted </br> " + percentage + "</div>");
}
if (status == "User Acceptance Testing") {
$("#" + proj_ID + " .ms-vb2:eq(3)").html("<div style='position:relative; width:100% ;background:#FFFF66; z-index:0; padding:20px 2px; coor:black; height:23px; text-align:center;'>UAT</div>");
}
});
});
</script>
IE8에서 JS 오류를 발생시키는 코드 줄을 확인해 주시겠습니까? 개발자 도구의 스크립트 콘솔 창을 사용하여 확인할 수 있습니다. –
이상하게도 오류가없는 경우 ie8 – pathfinder
에 console.log()를 사용하면 스크립트가 올바르게 기억됩니다. 코드가 작동을 멈 춥니 다. 또한 콘솔을 연 후에도 작동하는 것으로 나타났습니다. –