Hey all,
I am trying to remove some style from a table cell with JavaScript but it is not working as I wish it would. As you can see in the code below I am trying to remove all borders from cells that are dotted. If I use the following code, all borders will change to “medium none. From this…
style="BORDER-RIGHT: dotted; BORDER-TOP: dotted; BORDER-LEFT: dotted; BORDER-BOTTOM: dotted "
To that…
style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none"
I would like it to remove all border styles without removing any other styles if there are any. If there is a width style it would end up like this:
style=WIDTH: 100px
The code to change is commented.
function SetupForHTML()
{
var TE = document.getElementById('TextEditor');
var TEcn=TE.children;
var i;
for (i=0;i<TEcn.length;i++)
{
a(TEcn[i]);
}
}
function a(TEcn)
{
if (TEcn.nodeName.toLowerCase() == "td")
{
if (TEcn.style.borderBottom == "dotted")
// TEcn.style.borderBottom = "";
if (TEcn.style.borderTop == "dotted")
// TEcn.style.borderTop = "";
if (TEcn.style.borderLeft == "dotted")
// TEcn.style.borderLeft = "";
if (TEcn.style.borderRight == "dotted")
// TEcn.style.borderRight = "";
}
var TEchildren=TEcn.children;
var j;
for (j=0;j<TEchildren.length;j++)
{
a(TEchildren[j]);
}
}
Anyone can help me?
TIA
Mat