属性
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. UVALive - 7752 Free Figurines

    题意:有n个娃娃,如果大娃娃j直接套小娃娃i,则fa[i] = j.若fa[i] = 0,则该娃娃自由.给出每个娃娃初始的父亲,和改变后的父亲,在满足以下合法操作的条件下,问最少需要多少次变换. 1. ...

  2. spingcloud--hystrix(断路器)

    hystrix由来:服务器宕机或者依赖关系失败. hystrix: Hystrix是一个用于处理分布式系统的延迟和容错的开源库,在分布式系统里,许多依赖不可避免的会调用失败,比如超时.异常等,Hyst ...

  3. 干干净净的grep

    用grep -rn "xxxx" ./   搜索. 有时候出现大量的 错误信息 主要有 1.Is a directory 2.no such file or directory 前 ...

  4. Ajax学习系列——向服务器发送请求

    1.如何发送请求? 如果需要向服务器发送请求,我们使用的是XMLHttpRequest对象中的open()和send()方法. var xhr = new XMLHttpRequest();//具体创 ...

  5. Go语言 使用append() 为切片动态添加元素

    Go语言的内建函数 append() 可以为切片动态添加元素.不过需要注意的是,在使用 append() 函数为切片动态添加元素时,如果空间不足以容纳足够多的元素,切片就会进行“扩容”,此时新切片的长 ...

  6. PhotoView 实现与图片进行简单的交互

    本文的category是根据VIPhotoView来做参考,在此基础上添加个加载网络图片. 此category主要功能是与图片进行交互,双击放大图片,捏合等操作. 感谢vitoziv ! VIPhot ...

  7. 5分钟搞懂:基于token的用户认证

    https://www.qikegu.com/easy-understanding/880 用户认证 用户认证或者说用户登录是确认某人确实是某人的过程,生活中靠身份证,网络上就要靠账号和密码.用户提供 ...

  8. oracle问题:char类型数据查询不到

    select distinct id,name from test_table b where b.ID='001' ; id为char字段类型,使用该语句查询不出数据. 解决方法:加trim().改 ...

  9. 第八篇Django分页

    Django分页 1.复杂版 data = [] , ): tmp = {"id": i, "name": "alex-{}".format ...

  10. 数据库的交互模式 常用的dos命令 (第一天)

    浏览器和服务器和数据库的交互模式 windows nt(windows系统)的分类:服务操作系统有(server03 server08(R2) 12 16) 个人操作系统有(xp win7 win8 ...