手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >IE6不能修改NAME问题的解决方法
IE6不能修改NAME问题的解决方法
摘要:TheNAMEattributecannotbesetatruntimeonelementsdynamicallycreatedwithth...

The NAME attribute cannot be set at run time on elements dynamically created with the createElement method.

To create an element with a name attribute, include the attribute and value when using the createElement method.

也就是说,你得这么写

复制代码 代码如下:

document.createElement('<input type="text" name="username" >');

看起来都觉得不爽,而且不支持FF.

如果你使用了Jquery的clone方法,然后想在复制之后修改元素的name属性,那是不会成功的,简单一点的办法是新建一个,然后删掉原来那个。

复制代码 代码如下:

$('<input type="text" name="username" />').appendTo(xxx.parent());

xxx.remove();

【IE6不能修改NAME问题的解决方法】相关文章:

jQuery实现不断闪烁文字的方法

iscroll.js的上拉下拉刷新时无法回弹的解决方法

javascript带回调函数的异步脚本载入方法实例分析

javascript常用的方法分享

跨浏览器的设置innerHTML方法

jQuery实现自动滚动到页面顶端的方法

jQuery fancybox在ie浏览器下无法显示关闭按钮的解决办法

微信jssdk在iframe页面失效问题的解决措施

JQuery中两个ul标签的li互相移动实现方法

JavaScript获取两个数组交集的方法

精品推荐
分类导航