setAttribute 添加属性js_jq
属性
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的更多相关文章
- setAttribute改变属性,动态改变类
<style type="text/css"> .box{color:red;} </style> <div>通过setAttribute添加d ...
- 给HTML页面指定元素添加属性,添加父元素
给HTML页面指定元素添加属性,添加父元素 下面拿一个给富文本中所有的图片增加layer弹窗效果. 思路: 给富文本父元素设置属性. 获取父元素里所有的img 此处用到querySelectorA ...
- runtime-给系统已有类添加属性
在没有接触runtime之前,我们接触到的能给类进行扩展的方法有类目(category)和延展(extension)两种.类目(category)可以给系统已有类添加扩展方法但是不能添加属性,并且被添 ...
- JS Div滚动,下拉框添加属性,年月日下拉条
创建某一下拉菜单的项: str = str+"<option value='"+i+"'>"+i+"</option>&quo ...
- ios动态添加属性的几种方法
http://blog.csdn.net/shengyumojian/article/details/44919695 在ios运行过程中,有几种方式能够动态的添加属性. 1-通过runtime动态关 ...
- MVC @Html.TextBox 添加属性和样式
1.添加属性:@Html.TextBox("CnAddressmodify","", new { maxlength="90" }) 2.添 ...
- Runtime(动态添加属性)
下面通过一个实例展示一下Runtime(动态添加属性)的用法 下面对运行时添加属性用到的策略参数进行补充: 这样看来,前面的NSString* name用的策略是retain nonatomic就知道 ...
- 通过运行时动态给OC分类添加属性
#import <UIKit/UIKit.h> /** iOS 开发中,分类默认不允许保存属性 如果在分类中,定义一个属性,需要自己实现 getter & setter 方法,而且 ...
- 给分类(Category)添加属性
遇到一个问题,写了一个分类,但原先类的属性不够用.添加一个属性,调用的时候崩溃了,说是找不到getter.setter方法.查了下文档发现,OC的分类允许给分类添加属性,但不会自动生成getter.s ...
随机推荐
- 抓取屏幕并压缩生成HBITMAP
HBITMAP GetScreenBmp() { HWND hwnd = ::GetDesktopWindow(); HDC hsrc = ::GetDC(hwnd); HDC hmemdc = :: ...
- 端口通不通 telnet wget ssh
如何测试端口通不通(四种方法) 投稿:mrr 一般情况下使用"telnet ip port"判断端口通不通.接下来通过本文给大家分享四种方法测试端口通不通,感兴趣的朋友一起学习吧 ...
- Spring源码分析——(001)环境搭建
1.官方参考 spring-framework的github链接:https://github.com/spring-projects/spring-framework 源码环境搭建官方参考1:考如何 ...
- 记录一次ajax使用
function getSSOUrl(urlvalue) { var urls; $.ajax({ type: "GET", url: "../../GeoManage/ ...
- 对于python 3.x与python2.x中新型类的继承特性总结
(1)一般性继承特性 """ 该文件对于python 3.x 及python 2.x的New-style 类的一般性继承特性进行了说明和测试. (1)实例的继承特性:搜寻 ...
- Python安装bs4
- 需要将pip源设置为国内源,阿里源.豆瓣源.网易源等 - windows (1)打开文件资源管理器(文件夹地址栏中) (2)地址栏上面输入 %appdata% (3)在这里面新建一个文件夹 pip ...
- VUE中常用的一些方法
1.获取URL中的参数 export function getUrlKey(name) { return decodeURIComponent((new RegExp('[?|&]' + na ...
- js实现鼠标单击或者双击事件
// timer为全局变量 getClickEmail1(_type) { clearTimeout(this.timer); if (_type == 1) { if (event.detail = ...
- PL/SQL表结构/数据的导出
1.表结构导出 方法一:在sql页面点击表名,进入表编辑页面,点击右下角“查看SQL”按钮,即可看到表结构 方法二:工具--导出用户对象 去掉所有者勾选项,即***.表名:用户名字在其他用户导入数据库 ...
- 洛谷 P2004 领地选择
题目传送门 解题思路: 二维前缀和. AC代码: #include<iostream> #include<cstdio> using namespace std; ][],an ...