<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script type="text/javascript">
function Map(linkItems) {
this.current = undefined;
this._size = 0;
if(linkItems === false){
this.disableLinking();
}
}
/**
* 获取当前map
* @return 当前对象
*/
Map.noop = function() {
return this;
};
/**
* 非法操作
* @return
*/
Map.illegal = function() {
throw new Error("非法操作,Map已经被禁用");
};
/**
*
* @param obj
* @param foreignKeys
* @return
*/
Map.from = function(obj, foreignKeys) {
var map = new Map;
for(var prop in obj) {
if(foreignKeys || obj.hasOwnProperty(prop)){
map.put(prop, obj[prop]);
}
}
return map;
};
/**
* 禁用map
* @return
*/
Map.prototype.disableLinking = function() {
this.link = Map.noop;
this.unlink = Map.noop;
this.disableLinking = Map.noop;
this.next = Map.illegal;
this.key = Map.illegal;
this.value = Map.illegal;
this.clear = Map.illegal;
return this;
};
/**
* 返回hash值 例如:number 123
* @param value key/value
* @return
*/
Map.prototype.hash = function(value) {
return (typeof value) + ' ' + (value instanceof Object ? (value.__hash || (value.__hash = ++arguments.callee.current)) : value.toString());
};
/**
* 返回map的长度
* @return
*/
Map.prototype.size = function() {
return this._size;
};
Map.prototype.hash.current = 0;
/**
* 通过key获取value
* @param key
* @return
*/
Map.prototype.get = function(key) {
var item = this[this.hash(key)];
return item === undefined ? undefined : item.value;
};
/**
* 向map中添加数据
* @param key 键
* @param value 值
* @return
*/
Map.prototype.put = function(key, value) {
var hash = this.hash(key);
if(this[hash] === undefined) {
var item = { key : key, value : value };
this[hash] = item;
this.link(item);
++this._size;
}else{
this[hash].value = value;
}
return this;
};
/**
* 通过key删除数据
* @param key
* @return
*/
Map.prototype.remove = function(key) {
var hash = this.hash(key);
var item = this[hash];
if(item !== undefined) {
--this._size;
this.unlink(item);
delete this[hash];
}
return this;
};
/**
* 清除map
* @return
*/
Map.prototype.clear = function() {
while(this._size){
this.remove(this.key());
}
return this;
};
/**
* 处理队列
* @param item
* @return
*/
Map.prototype.link = function(item) {
if(this._size == 0) {
item.prev = item;
item.next = item;
this.current = item;
}else {
item.prev = this.current.prev;
item.prev.next = item;
item.next = this.current;
this.current.prev = item;
}
};
Map.prototype.unlink = function(item) {
if(this._size == 0){
this.current = undefined;
}else {
item.prev.next = item.next;
item.next.prev = item.prev;
if(item === this.current){
this.current = item.next;
}
}
};
/**
* 获取下一个
* @return
*/
Map.prototype.next = function() {
this.current = this.current.next;
return this;
};
/**
* 获取key
* @return
*/
Map.prototype.key = function() {
return this.current.key;
};
/**
* 获取value
* @return
*/
Map.prototype.value = function() {
return this.current.value;
};
function a()
{
var map=new Map();
map.put('5',5);
map.put('1',1);
var ops = document.getElementById("sel").options;
for(i=0;i<ops.length;i++)
{
if(map.get(ops.options[i].value) != undefined)
{
//alert(map.get(ops.options[i].value));
ops.options.remove(i);
}
}
}
</script>
</head>
<body>
<select id="sel" style="width:200px">
<option value=1 alt="abc"> 1 </option>
<option value=2> 2 </option>
<option value=3> 3 </option>
<option value=4> 4 </option>
<option value=5> 5 </option>
<option value=6> 6 </option>
<option value=7> 7 </option>
<option value=8> 8 </option>
<option value=9> 9 </option>
</select>
<input type="button" value="aaaaaa" onclick="a()">
</body>
</html>
分享到:
相关推荐
其实不然,还有或多或少的残留文件还悄悄地隐藏在你Wordpress数据库中的wp_options表中,如此长此发展下去,我们的数据库会在不知不觉中,变的越来越越庞大。 而且,WordPress管理后台的首页或其它页面,还会自动...
gin跨域支持options请求。亲测可用啊,这个是一个大佬发给我的
Logitech Options
vls参数,含600多条options命令,表格经过精心整理且分类,附带每条参数的中文说明及格式
罗技 新版options+ 驱动
Options,Futures And Other Derivatives 华尔街圣典 John Hull著 张陶伟译 第3版 中文版
罗技(logi) Logi Options Mac 安装包,可个性化设置配套鼠标操作,直接下载太慢了,上传上来方便下载
idea64.exe.vmoptions
Logitech Options for mac 官网下载特别慢,放在这里给大家下这用,正版免费软件,只是给大家多一个下载的途径。 免费下载,评论区留下你的好评。 Software Version: 8.20.233 Last Update: 2020-05-19 OS: macOS ...
X-Frame-Options HTTP响应头是用来确认是否浏览器可以在frame或iframe标签中渲染一个页面,网站可以用这个头来保证他们的内容不会被嵌入到其它网站中,以来避免点击劫持。 恶意攻击者可以利用漏洞攻击做到: 击者...
Allegro应用技术 界面OPTIONS,FIND.doc Allegro应用技术 界面OPTIONS,FIND.doc Allegro应用技术 界面OPTIONS,FIND.doc Allegro应用技术 界面OPTIONS,FIND.doc Allegro应用技术 界面OPTIONS,FIND.doc
点击劫持:X-Frame-Options头缺失 in a frame because it set 'X-Frame-Options' to 'deny'
Mac罗技鼠标管理器Options_8.34.91.zip
MATLAB关于遗传算法ga函数使用中option参数的设置至关重要,如变异概率,种群个数等都在OPTIONS中,文件里将详细介绍各参数含义及属性特点。
主要介绍了解决axios会发送两次请求,有个OPTIONS请求的问题,需要的朋友可以参考下
M185配码软件Options_8.0.863支持nano迷你接收器,如果第一个不支持,试试这个。 Uniflying250.exe 支持有小太阳标记的罗技设备配对,六通道设备,同时支持六个设备. 具体说明:【迷你Nano接收器】是2.4G单通道的,...
Options_8.34.82.exe
Logitect Options
X-Frame-Options头缺失漏洞 修复需要ClickjackFilter.jar ,引入esapi.jar(内含ClickjackFilter)即可。
主要介绍了Vue的Options用法说明,具有很好的参考价值,希望对大家有所