zoukankan      html  css  js  c++  java
  • JS:用js读取、设置元素属性

    setAttribute()方法

    添加指定的属性,并为其赋指定的值

    如果这个指定的属性已经存在,则仅更改值;

    elementObject.setAttribute(attributename, attributevalue);

    参数:

    attributename:string.必需。属性名称

    attributevalue:string.必需。属性值

    返回值无返回值

    例子:

    document.getElementsByTagName("input")[0].setAttribute('type', 'button');

    详情

    getAttribute()

    原型:

    element.getAttribute(attributenamestring)

    参数:

    attributenamestring:字符串。必需。需要获得其属性的属性名称

    返回值

    若属性存在,string,指定属性的值

    若属性不存在,返回null

    寻找爱
  • 相关阅读:
    Docker
    Web
    爬虫
    Python
    软件脱壳
    网络抓包
    HTTPS单向认证,双向认证
    新版无完整背景图片滑块验证码
    Frida Hook
    闭包函数与装饰器
  • 原文地址:https://www.cnblogs.com/carolina/p/5623120.html
Copyright © 2011-2022 走看看