Js动态生成Input标签
在IE中input.name不能正常赋值:
由于Name属性在不同浏览器赋值不同,所以在操作时应该注意。
/**生成Input标签**/
function generateInput(type,id,name){
var input;
if(document.all){
if(name != null && name != ""){
input = document.createElement('<input name="' + name + '">');//IE代码
}else{
input = document.createElement('<input');//IE代码
}
}else{
input = document.createElement('input'); //其他
if(name != null && name != ""){
input.name = name;
}
}
if(type == null || type == ""){
type = "text"
}else{
input.type = type;
}
if(id != null && id != ""){
input.id = id;
}
input.value = "";
//document.body.applyElement(input);
document.body.appendChild(input);
};
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
蕃薯耀 2013年12月7日 15:28:02 星期六
最后
以上就是紧张夏天最近收集整理的关于Js动态生成Input标签的全部内容,更多相关Js动态生成Input标签内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复