本文目录一览:
- 1、js 如何控制自动生成的的input 必输入字段
- 2、javascriptcollectionagent.dll可以删吗
- 3、如何在编辑表单中预填充collection
- 4、ArrayList在js里面怎么添加数据
js 如何控制自动生成的的input 必输入字段
用getElementById
$("form").submit(function() {
if (document.getElementById.val().replace(/s/g, '') == '') {
alertBox._warn("请填写申请员工编号!");
return false;
}
javascriptcollectionagent.dll可以删吗
此文件属于产品的Internet Explorer的 ,并制定了公司的Microsoft Corporation的。 该文件描述JavaScript Performance Collection Agent的。
此文件是动态链接库。这个库可以在任何正在运行的进程加载并执行。
如何在编辑表单中预填充collection
chrome 表单自动填充后,input文本框的背景会变成黄色的,通过审查元素可以看到这是由于chrome会默认给自动填充的input表单加上input:-webkit-autofill私有属性,然后对其赋予以下样式:
input : -webkit-autofill {
background-color : #FAFFBD ;
background-image : none ;
color : #000 ;
}
在有些情况下,这个黄色的背景会影响到我们界面的效果,尤其是在我们给input文本框使用图片背景的时候,原来的圆角和边框都被覆盖了:
情景一:input文本框是纯色背景的
可以对input:-webkit-autofill使用足够大的纯色内阴影来覆盖input输入框的黄色背景;如:
input : -webkit-autofill {
-webkit-box-shadow : 0 0 0px 1000px white inset ;
border : 1px solid #CCC !important ;
}
如果你有使用圆角等属性,或者发现输入框的长度高度不太对,可以对其进行调整,除了chrome默认定义的background-color,background-image,color不能用!important提升其优先级以外,其他的属性均可使用!important提升其优先级,如:
input : -webkit-autofill {
-webkit-box-shadow : 0 0 0px 1000px white inset ;
border : 1px solid #CCC !important ;
height : 27px !important ;
line-height : 27px !important ;
border-radius : 0 4px 4px 0 ;
}
情景二:input文本框是使用图片背景的
这个比较麻烦,目前还没找到完美的解决方法,有两种选择:
1、如果你的图片背景不太复杂,只有一些简单的内阴影,那个人觉得完全可以使用上面介绍的方法用足够大的纯色内阴影去覆盖掉黄色背景,此时只不过是没有了原来的内阴影效果罢了。
2、如果你实在想留住原来的内阴影效果,那就只能牺牲chrome自动填充表单的功能,使用 js 去实现,例如:
$ ( function () {
if ( navigator . userAgent . toLowerCase (). indexOf ( "chrome" ) = 0 ) {
$ ( window ). load ( function (){
$ ( 'ul input:not(input[type=submit])' ). each ( function (){
var outHtml = this . outerHTML ;
$ ( this ). append ( outHtml );
});
});
}
});
遍历的对象可能要根据你的需求去调整。如果你不想使用js,好吧,在form标签上直接关闭了表单的自动填充功能:autocomplete="off"。
上面是在网上找到的一些方法,我是用的图片背景,经过实验如果用js的方法会导致提交表单的时候重置而无法将value传过去,没办法只能是将自动填充的功能关闭了,虽然影响了部分用户的体验,但是解决了黄色背景影响整体UI的问题。
ArrayList在js里面怎么添加数据
1.ArrayList方法摘要
构造方法摘要
ArrayList()
构造一个初始容量为 10 的空列表。
ArrayList(Collection? extends E c)
构造一个包含指定 collection 的元素的列表,这些元素是按照该 collection 的迭代器返回它们的顺序排列的。
ArrayList(int initialCapacity)
构造一个具有指定初始容量的空列表。
方法摘要
boolean add(E e)
将指定的元素添加到此列表的尾部。
void add(int index, E element)
将指定的元素插入此列表中的指定位置。
boolean addAll(Collection? extends E c)
按照指定 collection 的迭代器所返回的元素顺序,将该 collection 中的所有元素添加到此列表的尾部。
boolean addAll(int index, Collection? extends E c)
从指定的位置开始,将指定 collection 中的所有元素插入到此列表中。
void clear()
移除此列表中的所有元素。
Object clone()
返回此 ArrayList 实例的浅表副本。
boolean contains(Object o)
如果此列表中包含指定的元素,则返回 true。
void ensureCapacity(int minCapacity)
如有必要,增加此 ArrayList 实例的容量,以确保它至少能够容纳最小容量参数所指定的元素数。
E get(int index)
返回此列表中指定位置上的元素。
int indexOf(Object o)
返回此列表中首次出现的指定元素的索引,或如果此列表不包含元素,则返回 -1。
boolean isEmpty()
如果此列表中没有元素,则返回 true
int lastIndexOf(Object o)
返回此列表中最后一次出现的指定元素的索引,或如果此列表不包含索引,则返回 -1。
E remove(int index)
移除此列表中指定位置上的元素。
boolean remove(Object o)
移除此列表中首次出现的指定元素(如果存在)。
protected void removeRange(int fromIndex, int toIndex)
移除列表中索引在 fromIndex(包括)和 toIndex(不包括)之间的所有元素。
E set(int index, E element)
用指定的元素替代此列表中指定位置上的元素。
int size()
返回此列表中的元素数。
Object[] toArray()
按适当顺序(从第一个到最后一个元素)返回包含此列表中所有元素的数组。
T T[] toArray(T[] a)
按适当顺序(从第一个到最后一个元素)返回包含此列表中所有元素的数组;返回数组的运行时类型是指定数组的运行时类型。
void trimToSize()
将此 ArrayList 实例的容量调整为列表的当前大小。
2.js实现部分功能
复制代码 代码如下:
html
script type="text/javascript" src="json.js"/script
head
script type="text/javascript"
function ArrayList(){
this.arr=[],
this.size=function(){
return this.arr.length;
},
this.add=function(){
if(arguments.length==1){
this.arr.push(arguments[0]);
}else if(arguments.length=2){
var deleteItem=this.arr[arguments[0]];
this.arr.splice(arguments[0],1,arguments[1],deleteItem)
}
return this;
},
this.get=function(index){
return this.arr[index];
},
this.removeIndex=function(index){
this.arr.splice(index,1);
},
this.removeObj=function(obj){
this.removeIndex);
},
this.indexOf=function(obj){
for(var i=0;ithis.arr.length;i++){
if [i]===obj) {
return i;
};
}
return -1;
},
this.isEmpty=function(){
return this.arr.length==0;
},
this.clear=function(){
this.arr=[];
},
this.contains=function(obj){
return this.indexOf(obj)!=-1;
}
};
//新建一个List
var list=new ArrayList();
//增加一个元素
list.add("0").add("1").add("2").add("3");
//增加指定位置
list.add(2,"22222222222");
//删除指定元素
list.removeObj("3");
//删除指定位置元素
list.removeIndex(0);
for(var i=0;ilist.size();i++){
document.writeln(list.get(i));
}
document.writeln(list.contains("2"))
/script
/head
body
/body
/html