📄 table_test.js
字号:
//表单操作的对象
function table(rows,columns){
this.rows = rows
this.columns = columns
this.border=0
this.data = new Array(rows*columns)
this.header = new Array(rows*columns)
this.getvalue = table_getValue
this.setvalue = table_setValue
this.isheader=table_isHeader
this.set=table_set
this.makeHeader=table_makeHeader
this.makeNormal=table_makeNormal
this.makeHeaderRow=table_makeHeaderRow
this.makeHeaderColumn=table_makeHeaderColumn
this.write=table_write
}
function table_getValue(row,col){
return this.data[row*this.columns+col]
}
function table_setValue(row,col,vlaue){
this.data[row*this.columns+col]=value
}
function table_set(contents){
var n=contents.length
for(var j=0;j<n;++j) this.data[j]=contents[j]
}
function table_isHeader(row,col){
return this.header[row*this.columns+col]
}
function table_makeHeader(row,col){
this.header[row*this.columns+col]=true
}
function table_makeNormal(row,col){
this.header[row*this.columns+col]=true
}
function table_makeHeaderRow(row){
for(var j=0;j<this.columns;++j)
this.header[row*this.columns+col]=true
}
function table_makeHeaderColumn(col){
for(var i=0;i<this.rows;++i)
this.header[i*this.columns+col]=true
}
function table_write(doc){
doc.write("<table border="+this.border+" id=tbl>")
for(var i=0;i<this.rows;++i){
doc.write("<tr")
for(var j=0;j<this.columns;++j){
if(this.header[i*this.columns+j]){
doc.write("<th>")
doc.write(this.data[i*this.columns+j])
doc.write("</th>")
}else{
doc.write("<td>")
doc.write(this.data[i*this.columns+j])
doc.write("</td>")
}
}
doc.writeln("</tr>")
}
doc.writeln("</table>")
}
//******/
function tabStart(){
obj=window.event.srcElement;
col1.value=obj.cellIndex;
row1.value=obj.parentElement.rowIndex;
}
function tabEnd(){
obj=window.event.srcElement;
col1.value=obj.cellIndex;
row1.value=obj.parentElement.rowIndex;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -