属性
js setAttribute
document.getElementsByName("test")[0].setAttribute("src", "../img/jia.png");

jquery attr
$("#id").attr("src", "../img/jia.png");

var po = {};
po.zt = 0;
po.sj = "00:22";
po.name = "赵家湖";
po.phone = "13500000958";
po.qxd = "石井山抢修队001";
var popu = initwgdsjDiv(po);
function  abc(a) {

    debugger
  console.log(a.getAttribute('mapphone'));
}
//弹窗例子,未派单的工单弹窗写死的
function initwgdsjDiv(map) { var list = document.createElement('div');
list.style.cssText = "width: 220px;height:154px;border-radius:10px;box-shadow:0px 10px 15px rgba(214,214,214,0.5);"; var div1 = document.createElement('div');
div1.style.cssText = " height: 33px; position: relative; top: -25px; padding-left: 21px;"; var img1 = document.createElement('img'); var div2 = document.createElement('div');
div2.style.cssText = "width: 100px; height: 20px; text-align: center; float: left;";
var img2 = document.createElement('img');
img2.src = "./img/6.png";
div2.appendChild(img2); var div3 = document.createElement('div');
div3.style.cssText = "width: 110px; height: 20px; text-align: center; float: right;";
var img3 = document.createElement('img');
img3.src = "./img/7.png";
div3.appendChild(img3); var div4 = document.createElement('div');
div4.style.cssText = "width: 100px; height: 35px; text-align: center; float: left; font-size: 21px;font-family: -webkit-pictograph;font-weight: bold;line-height: 35px;font-size:24px;font-family:Arial;font-weight:bold;line-height:28px;color:rgba(60,60,60,1);";
div4.id = "SJ";
div4.innerText = map.sj; var div5 = document.createElement('div');
div5.style.cssText = "width: 110px; height: 38px; float: right;"; var div51 = document.createElement('div');
div51.style.cssText = "font-weight: 600; height: 20px; text-align: center;font-size:18px;font-family:PingFang SC;";
div51.id = "WXRY";
div51.innerText = map.name;
var div52 = document.createElement('div');//手机号码
div52.style.cssText = "width: 100px; height: 22px; text-align: center; font-size: 12px;color: rgba(39, 39, 39, 0.57);font-weight:400;font-family:Arial; padding-top:5px;line-height:17px;";
div52.id = "LXDH";
div52.innerText = map.phone;
div5.appendChild(div51);
div5.appendChild(div52); var div6 = document.createElement('div');
div6.style.cssText = "padding-top: 5px;width: 100px; float: left; text-align: center; font-size: 12px;font-family:PingFang SC;font-weight:400;padding-top: 2px;";
div6.innerText = "派单倒计时";
img1.src = "./img/15.png";
div1.appendChild(img1); var div7 = document.createElement('div');
div7.style.cssText = "width: 110px; float: right; font-size: 12px;font-family:PingFang SC;font-weight:400;line-height:17px;padding-top:2px;";
div7.id = "QXD";
div7.innerText = map.qxd; //按钮
var values = '派单';
var idflag = 'idflag';
var div8 = document.createElement('div');
div8.style.cssText = "width:30%;float: left;display;inline-block;padding-top:8px;margin-left:12px;";//按钮位置
var button1 = document.createElement("input");
button1.setAttribute("type", "button");
button1.setAttribute("value", values);
button1.setAttribute("id", idflag);
// button.setAttribute("class", class);
button1.setAttribute("class", 'butclass');
button1.style.cssText = "background: rgba(85, 201, 194, 1);color: rgba(255, 255, 255, 1);";//按钮中字体
button1.setAttribute("mapPhone", map.phone);
  button1.setAttribute("onclick", 'abc(this)');
    button1.setAttribute("onclick", 'abc('+map+')');
div8.appendChild(button1); var div9 = document.createElement('div');
div9.style.cssText = "width:30%;display:inline-block;display;inline-block;padding-top:4px;";
var button2 = document.createElement("input");
button2.setAttribute("type", "button");
button2.setAttribute("value", '工单处理');
button2.setAttribute("id", idflag);
// button.setAttribute("class", class);
button2.setAttribute("class", 'butclass butfont');
button2.setAttribute("onclick", "function(this.id)");
div9.appendChild(button2); var div10 = document.createElement('div');
div10.style.cssText = "width:30%;display:inline-block;display;inline-block;padding-top:4px;";
var button3 = document.createElement("input");
button3.setAttribute("type", "button");
button3.setAttribute("value", '审核');
button3.setAttribute("id", idflag);
// button.setAttribute("class", class);
button3.setAttribute("class", 'butclass butfont');
button3.setAttribute("onclick", "function(this.id)");
div10.appendChild(button3); // var button = "<a role='button' id="+jinfo[i].id+" onclick='function(this.id)'><i class='icon-edit'></i></a>";
// div8.innerHTML += button; list.appendChild(div1);
list.appendChild(div2);
list.appendChild(div3);
list.appendChild(div4);
list.appendChild(div5);
list.appendChild(div6);
list.appendChild(div7);
list.appendChild(div8);
list.appendChild(div9);
list.appendChild(div10);
return list;
}

setAttribute 添加属性js_jq的更多相关文章

  1. setAttribute改变属性,动态改变类

    <style type="text/css"> .box{color:red;} </style> <div>通过setAttribute添加d ...

  2. 给HTML页面指定元素添加属性,添加父元素

    给HTML页面指定元素添加属性,添加父元素 下面拿一个给富文本中所有的图片增加layer弹窗效果. 思路: 给富文本父元素设置属性. 获取父元素里所有的img   此处用到querySelectorA ...

  3. runtime-给系统已有类添加属性

    在没有接触runtime之前,我们接触到的能给类进行扩展的方法有类目(category)和延展(extension)两种.类目(category)可以给系统已有类添加扩展方法但是不能添加属性,并且被添 ...

  4. JS Div滚动,下拉框添加属性,年月日下拉条

    创建某一下拉菜单的项: str = str+"<option value='"+i+"'>"+i+"</option>&quo ...

  5. ios动态添加属性的几种方法

    http://blog.csdn.net/shengyumojian/article/details/44919695 在ios运行过程中,有几种方式能够动态的添加属性. 1-通过runtime动态关 ...

  6. MVC @Html.TextBox 添加属性和样式

    1.添加属性:@Html.TextBox("CnAddressmodify","", new { maxlength="90" }) 2.添 ...

  7. Runtime(动态添加属性)

    下面通过一个实例展示一下Runtime(动态添加属性)的用法 下面对运行时添加属性用到的策略参数进行补充: 这样看来,前面的NSString* name用的策略是retain nonatomic就知道 ...

  8. 通过运行时动态给OC分类添加属性

    #import <UIKit/UIKit.h> /** iOS 开发中,分类默认不允许保存属性 如果在分类中,定义一个属性,需要自己实现 getter & setter 方法,而且 ...

  9. 给分类(Category)添加属性

    遇到一个问题,写了一个分类,但原先类的属性不够用.添加一个属性,调用的时候崩溃了,说是找不到getter.setter方法.查了下文档发现,OC的分类允许给分类添加属性,但不会自动生成getter.s ...

随机推荐

  1. x86平台inline hook原理和实现

    概念 inline hook是一种通过修改机器码的方式来实现hook的技术. 原理 对于正常执行的程序,它的函数调用流程大概是这样的: 0x1000地址的call指令执行后跳转到0x3000地址处执行 ...

  2. 一百零三、SAP中常量的定义CONSTANTS

    一.代码如下 二.运行效果如下

  3. Java基础(接口,list和ArrayLIst)

    1,使用接口的目的:不是10类都有getName()方法,则10个类都继承一个接口来实现.接口本身是一种规范,在具体业务有需求的时候才用接口. 具体例子: I充电设备 x = new 手机(" ...

  4. Node.js 介绍

    章节 Node.js 介绍 Node.js 入门 Node.js 模块 Node.js HTTP模块 Node.js 文件系统模块 Node.js URL模块 Node.js NPM Node.js ...

  5. Java基础之枚举

    Java基础之枚举 作为1.5才增加的特性,枚举的使用并不是很多. 枚举其实就是一个比较特殊的类,就如同注解其实也是个特殊的接口一样(注解反编译之后没有了@符号).枚举使用enum关键字声明,通过反编 ...

  6. UVA - 557 Burger(汉堡)(dp+概率)

    题意:有n个牛肉堡和n个鸡肉堡给2n个孩子吃.每个孩子在吃之前都要抛硬币,正面吃牛肉堡,反面吃鸡肉堡.如果剩下的所有汉堡都一样,则不用抛硬币.求最后两个孩子吃到相同汉堡的概率. 分析: 1.先求最后两 ...

  7. 【Java Spring 进阶之路 】1.Spring 是什么?

  8. 【LeetCode】两个数相加

    [问题]给定两个非空链表来表示两个非负整数.位数按照逆序方式存储,它们的每个节点只存储单个数字.将两数相加返回一个新的链表. 你可以假设除了数字 0 之外,这两个数字都不会以零开头. [实例] 输入: ...

  9. PyTorch实战:经典模型LeNet5实现手写体识别

    在上一篇博客CNN核心概念理解中,我们以LeNet为例介绍了CNN的重要概念.在这篇博客中,我们将利用著名深度学习框架PyTorch实现LeNet5,并且利用它实现手写体字母的识别.训练数据采用经典的 ...

  10. Django学习路线