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 ...
随机推荐
- UVA - 10382 Watering Grass(几何)
题意:有一个矩形,n个圆.已知矩形的长宽和圆的半径,问最少需多少个圆将矩形完全覆盖. 分析: 1.首先求圆与矩形的长的交点,若无交点,则一定不能对用最少的圆覆盖矩形有贡献. 2.如果两个圆与矩形相交所 ...
- GNS3 模拟icmp禁止不可达
R1 : conf t int f0/0 no shutdown ip add 192.168.1.1 255.255.255.0 no ip routing end R2 f0/0: conf t ...
- 洛谷 P2549 计算器写作文
题目传送门 解题思路: 背包,f[i]表示计算器位数为i时,可获得的最大分值. 本题与01背包不同的地方在于,物品的摆放顺序对答案是有影响的,例如两个字符串a,b,那么就会出现a+b和b+a两种情况( ...
- 指令——rm
一个完整的指令的标准格式: Linux通用的格式——#指令主体(空格) [选项](空格) [操作对象] 一个指令可以包含多个选项,操作对象也可以是多个. 指令:rm (remove,移除.删除) 作用 ...
- Windows10 网络图标消失 连接不上网络 的解决方法
[背景]电脑win10的,下载一个软件重启之后网络图标消失,并且无法联网. 参照此解决方法: 原因: [Windows Event Log]服务对应的注册表出现问题,导致无法正常启动,进而导致一些依赖 ...
- Pycharm连接Mysql失败. [08001] Could not create connection to database server.
使用Pycharm连接MySQL时遇到如下问题,错误代码[08001] 查了很多资料归纳一下可能是如下几个原因 0.mysql.server没开 找到对应系统下的mysql.server 启动/重启命 ...
- JAVA - SpringBoot项目引用MyBatis操作数据库
JAVA - SpringBoot项目引用MyBatis操作数据库 1. 创建SpringBoot项目,参考:https://www.cnblogs.com/1285026182YUAN/p/1232 ...
- Docker Python 例子
版权所有,未经许可,禁止转载 章节 Docker 介绍 Docker 和虚拟机的区别 Docker 安装 Docker Hub Docker 镜像(image) Docker 容器(container ...
- 一、VIP课程:互联网工程专题 05-快速掌握Jenkins原理与核心功能
第五课:快速掌握jenkins核心功能.docx 2.164 (2019-02) and newer: Java 8 or Java 11 一.jenkins 概述与环境配置 知识点: 关于可持续化集 ...
- POJ 3984:迷宫问题 bfs+递归输出路径
迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11844 Accepted: 7094 Description ...