我有一个按钮表格,单击时它们的边框宽度从1px增加到3px。我看过Javascript - Changing border-width without moving surrounding elements.,Don't affect positioning of other elements on border-width changes和How to add padding or border to a DIV and keep width and height?但这些都没有帮助。我也尝试了框大小和轮廓属性,都没有工作。我有此Javascript:表在不移动其他表格元素的情况下更改边框宽度
function cur(curval) {
if (!prevElement) {
prevElement = document.getElementById(curval);
currentElement = prevElement;
} else {
prevElement = currentElement;
prevElement.style.borderWidth = "1px"
currentElement = document.getElementById(curval);
}
currentElement.style.borderWidth = "3px"
document.body.style.cursor = curval;
}
下面是部分:
<tr>
<td><button id="default" onclick="cur('default')"><img
src="default.png"/></button></td>
<td><button id="alias" onclick="cur('alias')"><img src="alais.png"/>
</button></td>
<td><button id="cell" onclick="cur('cell')"><img src="cell.png"/>
</button></td>
<td><button id="col-resize" onclick="cur('col-resize')"><img src="col-
resize.png"/></button></td>
<td><button id="copy" onclick="cur('copy')"><img src="copy.png"/>
</button></td>
<td><button id="crosshair" onclick="cur('crosshair')"><img
src="crosshairs.png"/></button></td>
</tr>
所有的按键都border: 1px solid black
他们点击,直到。 我怎么能做到这一点,边界宽度不会影响表中的其他元素?
请同时显示相关的HTML。 –
HTML请???? –