Ok so i'm using IE and Firefox. With firefox the below code works fine but runng in IE the onclick event from my form is never triggering the javascript function call. If i open the IE debugger and change this to an alert and than back to doClose it works fine. Any ideas?
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> var popupWindow = null; var popupIsShown = false; function getValues(){ //get all the elements that are inputs var inputs = document.getElementsByTagName("input"); var updates = new Array(); for(var i=0; i< inputs.length; i++){ if (inputs[i].type == "checkbox"){ //check if the box is checked if(inputs[i].checked){ //get to the row and get all the elements from it var row = inputs[i].parentNode.parentNode //skip the first cell since it is the checkbox //the rest of the rows are in the order of KPIName,KPI Category, KPI definition, KPI owner, MonthlyActual, Monthly Goal var tempData = new Array(); if (row.cells[1].childNodes[1] != null) tempData.push(row.cells[1].childNodes[1].innerHTML); else tempData.push(""); if (row.cells[2].childNodes[1] != null) tempData.push(row.cells[2].childNodes[1].innerHTML); else tempData.push(""); if (row.cells[3].childNodes[1]!=null) tempData.push(row.cells[3].childNodes[1].innerHTML); else tempData.push(""); if (row.cells[4].childNodes[1]!=null) tempData.push(row.cells[4].childNodes[1].innerHTML); else tempData.push(""); if (row.cells[5].childNodes[1]!=null) tempData.push(row.cells[5].childNodes[1].innerHTML); else tempData.push(""); if (row.cells[6].childNodes[1]!=null) tempData.push(row.cells[6].childNodes[1].innerHTML); else tempData.push(""); updates.push(tempData); } } } return updates; } function removeCheck(){ //get all the elements that are inputs var inputs = document.getElementsByTagName("input"); for(var i=0; i< inputs.length; i++){ if (inputs[i].type == "checkbox"){ if(inputs[i].checked){inputs[i].checked=false;} } } } function checkAll(){ //get all the elements that are inputs var inputs = document.getElementsByTagName("input"); for(var i=0; i< inputs.length; i++){ if (inputs[i].type == "checkbox"){ if(!inputs[i].checked){inputs[i].checked=true;} } } } //position the popup at the center of the page function positionPopup(){ if(!$("#editForm").is(':visible')){ return; } $("#editForm").css({ left: ($(window).width() - $('#editForm').width()) / 2, top: ($(window).width() - $('#editForm').width()) / 7, position:'absolute' }); } function doClose(){ $("#editForm").fadeOut(500); } function doUpdates(){
var updates = getValues(); //now with the selected cells pop open a box and add each one to a new window to update here and then push to a bean var form = document.createElement("form"); var table = document.createElement("table"); table.setAttribute("style","text-align:center"); var tbody = document.createElement("tbody"); //build the header for the table var header = document.createElement("tr"); var td1 = document.createElement("td"); td1.innerHTML = "KPI Name"; var td2 = document.createElement("td"); td2.innerHTML = "KPI Category"; var td3 = document.createElement("td"); td3.innerHTML = "KPI Definition"; var td4 = document.createElement("td"); td4.innerHTML = "KPI Owner"; var td5 = document.createElement("td"); td5.innerHTML = "Monthly Actual"; var td6 = document.createElement("td"); td6.innerHTML = "Monthly Goal";
var updateSize = updates.length; for (var i=0;i<updateSize;i++){ var row = updates.pop(); //reverse the array so that they remain in the same order when we pop them row = row.reverse(); //create a Table row object var tr = document.createElement("tr"); var rowSize = row.length; for (var j=0;j<rowSize;j++){ if (j<4){ var td = document.createElement("td"); var input = document.createElement("input"); input.setAttribute("value",row.pop()); input.setAttribute("name","tr"+i+"td"+j); input.setAttribute("id","tr"+i+"td"+j); input.setAttribute("type","text"); input.setAttribute("readonly","readonly"); input.setAttribute("disabled","disabled"); td.appendChild(input); tr.appendChild(td); } else{ var td = document.createElement("td"); var input = document.createElement("input"); input.setAttribute("value",row.pop()); input.setAttribute("name","tr"+i+"td"+j); input.setAttribute("id","tr"+i+"td"+j); input.setAttribute("type","text"); td.appendChild(input); tr.appendChild(td); } } tbody.appendChild(tr); } //now that we have everything append them table.appendChild(tbody); form.appendChild(table); //add a button to the form for submitting var submit = document.createElement("input"); submit.setAttribute("type","button"); submit.setAttribute("onclick","makeCall('update')"); submit.setAttribute("value","Submit Changes") var cancel = document.createElement("input"); cancel.setAttribute("type","button"); cancel.setAttribute("value","CANCEL"); cancel.setAttribute('onclick','doUpdates()');
var submitRow = document.createElement("tr"); var submitTD = document.createElement("td"); submitTD.setAttribute("colspan","6"); submitTD.appendChild(cancel); submitTD.appendChild(submit); submitRow.appendChild(submitTD); tbody.appendChild(submitRow); form.setAttribute("style","text-align:center"); form.setAttribute("id","editForm"); //now with everything built open the window and display the form //var win = window.open('https://dev-cognos10.intra.tdaf.com/cognos10/blank.html','null','width=900,height=750,toolbar=no,scrollbars=no,location=0,resizable =yes'); //MakePopup(); var newScript = document.createElement("script"); newScript.setAttribute("type","text/javascript"); newScript.text="function makeCall(text){alert('doThe Update');}"; document.getElementsByTagName('head')[0].appendChild(newScript); document.getElementsByTagName('body')[0].appendChild(form); //popupWindow.moveTo(0,0); //popupWindow.resizeTo(screen.width,screen.height-100); $("#editForm").fadeIn(500); positionPopup(); } function doDelete(){ //display a confirmation that the kpi will be deleted if they agree then go ahead and expire them var deletes = getValues(); var heading = document.createElement("h1"); heading.innerHTML = "THE FOLLOWING ENTRIES WILL BE DELETED Press OK to confirm or cancel to close"; heading.setAttribute("sytle","text-align:center");
var form = document.createElement("form"); var table = document.createElement("table"); table.setAttribute("style","text-align:center"); var tbody = document.createElement("tbody"); //build the header for the table var header = document.createElement("tr"); var td1 = document.createElement("td"); td1.innerHTML = "KPI Name"; var td2 = document.createElement("td"); td2.innerHTML = "KPI Category"; var td3 = document.createElement("td"); td3.innerHTML = "KPI Definition"; var td4 = document.createElement("td"); td4.innerHTML = "KPI Owner"; var td5 = document.createElement("td"); td5.innerHTML = "Monthly Actual"; var td6 = document.createElement("td"); td6.innerHTML = "Monthly Goal";
//create the heading to alert the user that these will be deleted var temptr = document.createElement("tr"); var temptd = document.createElement("td"); temptd.setAttribute("colspan","6"); temptd.appendChild(heading); temptr.appendChild(temptd); tbody.appendChild(temptr); tbody.appendChild(header);
var deleteSize = deletes.length; for (var i=0;i<deleteSize;i++){ var row = deletes.pop(); //reverse the array so that they remain in the same order when we pop them row = row.reverse(); //create a Table row object var tr = document.createElement("tr"); var rowSize = row.length; for (var j=0;j<rowSize;j++){ var td = document.createElement("td"); var input = document.createElement("input"); input.setAttribute("value",row.pop()); input.setAttribute("name","tr"+i+"td"+j); input.setAttribute("id","tr"+i+"td"+j); input.setAttribute("type","text"); input.setAttribute("readonly","readonly"); input.setAttribute("disabled","disabled"); td.appendChild(input); tr.appendChild(td); } tbody.appendChild(tr); } //now that we have everything append them table.appendChild(tbody); form.appendChild(table); //add a button to the form for submitting var submit = document.createElement("input"); submit.setAttribute("type","button"); submit.setAttribute("onclick","makeCall('delete')"); submit.setAttribute("value"," OK ") var cancel = document.createElement("input"); cancel.setAttribute("type","button"); cancel.setAttribute("value","CANCEL"); cancel.setAttribute("onclick","doClose()");
var submitRow = document.createElement("tr"); var submitTD = document.createElement("td");
submitTD.setAttribute("colspan","6"); submitTD.appendChild(cancel); submitTD.appendChild(submit); submitRow.appendChild(submitTD); tbody.appendChild(submitRow); form.setAttribute("style","text-align:center;display:none"); form.setAttribute("id","editForm"); //now with everything built open the window and display the form //var win = window.open('https://dev-cognos10.intra.tdaf.com/cognos10/blank.html','null','width=900,height=750,toolbar=no,scrollbars=no,location=0,resizable =yes'); var newScript = document.createElement("script"); newScript.setAttribute("type","text/javascript"); newScript.text="function makeCall(text){alert('doThe Delete');}"; document.getElementsByTagName('head')[0].appendChild(newScript); document.getElementsByTagName('body')[0].appendChild(form); $("#editForm").fadeIn(500); positionPopup(); //win.moveTo(0,0); //win.resizeTo(screen.width,screen.height-100); } function generateRow(counter){ var tr = document.createElement("tr"); for (var j=0;j<6;j++){ var td = document.createElement("td"); var input = document.createElement("input"); input.setAttribute("value",""); input.setAttribute("name","tr"+counter+"td"+j); input.setAttribute("id","tr"+counter+"td"+j); input.setAttribute("type","text"); td.appendChild(input); tr.appendChild(td); } return [tr,counter]; } function doInsert(){ //display the main header table with input types and a button to add more if you want them var form = document.createElement("form"); var table = document.createElement("table"); table.setAttribute("style","text-align:center"); table.setAttribute("id",'insertTable'); var tbody = document.createElement("tbody"); //build the header for the table var header = document.createElement("tr"); var td1 = document.createElement("td"); td1.innerHTML = "KPI Name"; var td2 = document.createElement("td"); td2.innerHTML = "KPI Category"; var td3 = document.createElement("td"); td3.innerHTML = "KPI Definition"; var td4 = document.createElement("td"); td4.innerHTML = "KPI Owner"; var td5 = document.createElement("td"); td5.innerHTML = "Monthly Actual"; var td6 = document.createElement("td"); td6.innerHTML = "Monthly Goal";
tbody.appendChild(header); var row = generateRow(0); tbody.appendChild(row[0]);
//now that we have everything append them table.appendChild(tbody); form.appendChild(table);
//add a button to the form for submitting var submit = document.createElement("input"); submit.setAttribute("type","button"); submit.setAttribute("onclick","makeCall('insert')"); submit.setAttribute("value","Submit Inserts")
var addrow = document.createElement("input"); addrow.setAttribute("type","button"); addrow.setAttribute("value","Add Row"); addrow.setAttribute("onclick","addRow(this)");
var cancel = document.createElement("input"); cancel.setAttribute("type","button"); cancel.setAttribute("value","CANCEL"); cancel.setAttribute("onclick","doClose()");
var submitRow = document.createElement("tr"); var submitTD = document.createElement("td");