`
czpae86
  • 浏览: 713702 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

通过document.createAttribute设置文本框文本域只读

 
阅读更多

代码片段:

var input = document.getElementById(f);
		if(input){
			var attr = document.createAttribute('readOnly');
			attr.value = true;
			input.setAttributeNode(attr);
		}else{
			continue;
		}
 
分享到:
评论

相关推荐

    js 用CreateElement动态创建标签示例

    //定义方法创建一个label标签 //*****************************... var label_id = document.createAttribute(“id”); label_id.nodeValue = id; var label_text = document.createTextNode(value); label_var.setAttr

    Delphi向XML中添加节点数据.rar

     iAttribute := iXml.createAttribute ('color');  iAttribute.nodeValue := 'red';  iNode2.attributes.setNamedItem (iAttribute);  Memo1.Lines.Text := FormatXMLData (XMLDocument1.XML.Text);  end;  你...

    JavaScript权威指南

    Document Information Properties Section 14.5. Forms Section 14.6. Images Section 14.7. Links Section 14.8. Anchors Section 14.9. Applets Section 14.10. Embedded Data Chapter 15. Forms...

    xml4种 解析方式

    在dom中利用XmlDocument doc=new XmlDocument()创建document对象, 利用"doc.createElement(节点名称)"来创建字节点,然后用"doc.createTextNode(节点内容)"来为节点添加内容! 利用"doc.createAttribute(节点属性名称)...

    编译的 HTML 帮助文件 (.chm) DHTML手册

    如果要在 HTC 文件中编码脚本,应使用 element.document 来引用主文档的 document 对象。 示例 下面的例子使用了 document 对象检查文档标题并在消息框中显示该标题(如果非空)。 if (document.title!="") alert(...

    浅谈js中的attributes和Attribute的用法与区别

    createAttribute:仅建立一个属性; removeAttribute:删除一个属性; getAttributeNode:获取一个节点作为对象; setAttributeNode:建立一个节点; removeAttributeNode:删除一个节点; 1.getAttribute: <...

    DataStory 为设计数据流图提供了一个工作台。

    开发安装 Clone it Run yarn && yarn watch Serve app from public/index.html 可用的默认节点 Clone_, Comment, Create, CreateAttribute, CreateGrid, CreateJSON, CreateSequence, DeleteRepositories, ...

    JS Attribute属性操作详解

    createAttribute:仅建立一个属性 removeAttribute:删除一个属性 getAttributeNode:获取一个节点作为对象 setAttributeNode:建立一个节点 removeAttributeNode:删除一个节点 attributes可以获取一个对象中的一个...

Global site tag (gtag.js) - Google Analytics