HTML高级应用

通过js遍历html对象的属性
function popUpProperties(inobj) {
    op = window.open();
    op.document.open('text/plain');
    for (objprop in inobj) {
    op.document.write(objprop + ' 的属性或方法:    ' + inobj[objprop] + '\n');
    }
    op.document.close();
}

Table的单元格保持宽度不变
代码如下: 关键是两个属性 1)word-wrap
2)word-break
以及标签 <wbr>
他能在需要换行的时候自动变作换行操作
<TABLE border="1" width="200" style="table-layout:fixed;">
<TR>
<TD>dfad</TD>
<TD style="100;word-wrap:break-word">
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
</TD>
</TR>
</TABLE>

<TABLE border="1" width="200" style="table-layout:auto;">
<TR>
<TD>dfad</TD>
<TD style="100;word-wrap:break-word;word-break:break-all; ">
testtesttesttesttesttest
<wbr>testtesttesttesttest<wbr>testtesttesttesttest</TD>
</TR>
</TABLE>

select元素的动态添加
<SCRIPT LANGUAGE="JScript">
var oOption = document.createElement("OPTION");
oOption.text
="Ferrari";
oOption.value
="4";
oSelect.add(oOption);
</SCRIPT>


原文地址:https://www.cnblogs.com/sekihin/p/577338.html
Creative Commons License 本作品采用 知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。