📄 map.js
字号:
/** NV pair object */
function NameValuePair(name, value) {
this.name = name;
this.value = value;
}
/** Simple Map object to store array of name/value pairs */
function Map() {
// Data members
this.index = 0;
this.map = new Array();
// Function members
this.get = MapGet;
this.put = MapPut;
this.toString = MapToString;
this.toTable = MapToTable;
}
/** get() */
function MapGet(name) {
for (var i=0; i < this.index; i++) {
if (this.map[i].name.match(name)) {
return this.map[i].value;
}
}
return '';
}
/** put() */
function MapPut(name, value) {
this.map[this.index++] = new NameValuePair(name, value);
}
/** To HTML string */
function MapToString() {
var res = '';
for (var i=0; i < this.index; i++) {
res = res + this.map[i].name+'='+this.map[i].value+'<BR>';
}
return res;
}
/** To HTML table */
function MapToTable() {
var res = '<table border=1 cellpadding=3>';
var styleDiv = "<div style=\"color:black; font-family:monospace; font-size:10pt; white-space:pre;\">"
for (var i=0; i < this.index; i++) {
res = res + '<tr><td bgColor=white>'+styleDiv+this.map[i].name+'</div></td><td bgColor=white>'+styleDiv+this.map[i].value+'</div></td></tr>';
}
res += '</table>'
return res;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -