14. februar 2003 - 11:49
Der er
9 kommentarer og 1 løsning
vis td border i wysiwyg
Hej er der nogen der kan få dette til at virke? Koden indtil videre. function tableBorders() { var aTables = idContent.document.getElementsByTagName("TABLE"); for (i=0; i < aTables.length; i++) { if(idContent.SHOWBORDER && (aTables[i].border == 0)){ aTables[i].runtimeStyle.borderWidth = 1; aTables[i].runtimeStyle.borderColor = "#cccccc"; aTables[i].runtimeStyle.borderStyle = "dotted"; aTables[i].runtimeStyle.borderCollapse = "collapse"; } else { aTables[i].runtimeStyle.borderColor = ""; aTables[i].runtimeStyle.borderStyle = "none"; aTables[i].runtimeStyle.borderCollapse = "collapse"; } var aRows = aTables[i].rows for (y=0; y < aRows.length; y++) { var aCells = aRows[y].cells for (x=0; x < aCells.length; x++) { if(idContent.SHOWBORDER && (aRows[i].border == 0)){ aRows[i].runtimeStyle.borderWidth = 1; aRows[i].runtimeStyle.borderColor = "#cccccc"; aRows[i].runtimeStyle.borderStyle = "dotted"; aRows[i].runtimeStyle.borderCollapse = "collapse"; } else { aRows[i].runtimeStyle.borderColor = ""; aRows[i].runtimeStyle.borderStyle = "none"; aRows[i].runtimeStyle.borderCollapse = "collapse"; } } } } } function showTableBorders() { idContent.SHOWBORDER = !idContent.SHOWBORDER; tableBorders(); } Den viser fint selve table, men td's tager den ikke med...
Annonceindlæg fra Lector
14. februar 2003 - 12:16
#2
Det synes jeg nu heller ikke virker. Du mener det skal se således ud ikke? function tableBorders() { var aTables = hovededitor.document.getElementsByTagName("TABLE"); for (i=0; i < aTables.length; i++) { if(hovededitor.SHOWBORDER && (aTables[i].border == 0)){ aTables[i].runtimeStyle.borderWidth = 1; aTables[i].runtimeStyle.borderColor = "#cccccc"; aTables[i].runtimeStyle.borderStyle = "dotted"; aTables[i].runtimeStyle.borderCollapse = "collapse"; } else { aTables[i].runtimeStyle.borderColor = ""; aTables[i].runtimeStyle.borderStyle = "none"; aTables[i].runtimeStyle.borderCollapse = "collapse"; } var aRows = aTables[i].rows for (y=0; y < aRows.length; y++) { var aCells = aRows[y].cells for (x=0; x < aCells.length; x++) { if(hovededitor.SHOWBORDER && (aCells[x].border == 0)){ aCells[x].runtimeStyle.borderWidth = 1; aCells[x].runtimeStyle.borderColor = "#cccccc"; aCells[x].runtimeStyle.borderStyle = "dotted"; aCells[x].runtimeStyle.borderCollapse = "collapse"; } else { aCells[x].runtimeStyle.borderColor = ""; aCells[x].runtimeStyle.borderStyle = "none"; aCells[x].runtimeStyle.borderCollapse = "collapse"; } } } } } function viskant() { hovededitor.SHOWBORDER = !hovededitor.SHOWBORDER; tableBorders(); }
14. februar 2003 - 14:55
#9
Det jeg mener er du kan rette til følgende: for (i=0; i < aTables.length; i++) { if(hovededitor.SHOWBORDER && (aTables[i].border == 0)){ aTables[i].runtimeStyle.borderWidth = 1; aTables[i].runtimeStyle.borderColor = "#cccccc"; aTables[i].runtimeStyle.borderStyle = "dotted"; aTables[i].runtimeStyle.borderCollapse = "collapse"; } else { aTables[i].runtimeStyle.borderColor = ""; aTables[i].runtimeStyle.borderStyle = "none"; aTables[i].runtimeStyle.borderCollapse = "collapse"; } var aRows = aTables[i].rows for (y=0; y < aRows.length; y++) { var aCells = aRows[y].cells for (x=0; x < aCells.length; x++) { if(hovededitor.SHOWBORDER){ aCells[x].runtimeStyle.borderWidth = 1; aCells[x].runtimeStyle.borderColor = "#cccccc"; aCells[x].runtimeStyle.borderStyle = "dotted"; } else { aCells[x].runtimeStyle.borderColor = ""; aCells[x].runtimeStyle.borderStyle = "none"; } } } } }