• javascript里面的document.getElementById


    一、getElementById:获取对 ID 标签属性为指定值的第一个对象的引用,它有 value 和 length 等属性

           1、获取当前页面的值input标签值:var attr1=document.getElementById("o_user_name").value;

           2、获取当前页面的值img标签值:var attr2=document.getElementById("o_user_image").src;

    案例1:

    //获取当前日期
    var o_origin_date_tags=document.getElementById("o_origin_date")
    if (o_origin_date_tags){
        var o_origin_date=o_origin_date_tags.value//获取标签的值
        this.$('.o_lunch_origin_date').val(o_origin_date); //设置默认值:通过jq获取对象并赋值
    }
        
    

      

    二、根据便签设置其样式

    例子:var attr1=document.getElementById("o_user_name")

               attr1.style.color="blue";    //设定风格的颜色属性为蓝色


    在jQuery获取o_user_name元素直接用$("o_user_name"),而设定o_user_name元素属性也用$("o_user_name").method();  //其中method是jQuery框架内部定义好的

    例如: this.$('.o_lunch_origin_date').val(o_origin_date);  //设置默认值:通过jq获取对象并赋值

    心有猛虎,细嗅蔷薇
  • 相关阅读:
    使用推荐使用的映射器和适配器
    第一个SpringMVC的注解应用
    简化SpringMVC配置
    第一个SpringMVC程序
    ettercap
    hashcat
    二维数组实现checkbox的分组多选
    安装 slowhttptest ddos攻击软件
    转载:windows的mysql提权方式
    windows c dll的创建与调用
  • 原文地址:https://www.cnblogs.com/1314520xh/p/14579690.html
Copyright © 2020-2023  润新知