<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
.red {
border: solid 1px red;
width: 200px;
height: 100px;
text-align: center;
line-height: 100px;
margin: auto;
} .blue {
border: solid 1px blue;
width: 200px;
height: 100px;
text-align: center;
line-height: 100px;
margin: auto;
}
</style>
<script type="text/javascript" src="../../js/system.js"></script>
</head>
<body>
<div id="a" class="red">
hello js,,
</div>
<div id="b">
html js2 ,,
</div>
<input type="button" value="点我变红" id="bitRed">
<script type="text/javascript">
36 //id名为b的元素的样式随着id名为a的元素的样式的变化而变化
var clasName = comm.getAttr($$("a"), "class"); //获取id名为a的元素的class样式,并把它赋给clasName;
comm.setAttr($$("b"), "class", clasName); //给id为b的元素设置class样式为clasName; $$("bitRed").onclick = function () {
// $$("a").setAttribute("class","blue");
comm.setAttr($$("a"), "class", "blue");
var clasName = comm.getAttr($$("a"), "class");
comm.setAttr($$("b"), "class", clasName);
}
</script>
</body>
</html>
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxwAAADsCAIAAABxHzfbAAAKDUlEQVR4nO3cS2/bVh7G4fN9u0h6n6+R9D6LLor6q9RJ7/U+aRwPZuJMMhMnTneVZ2HX0EgiTcv6m6Le5wFBSIeHFG0IOD9YStoZAAA31sa+AQC4ttZstqpt/bfl5t7hAHBLbrLyQQ9RBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlFFEVEFQBZRRRFRBUAWUUURUQVAFlF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KgCyiiiKiCoAsoooiogqALKKKIqIKgCyiiiKiCoAsoooiogqALKKKIqIKgCyiiiKiCoAsoooiogqALKKKIqIKgCyiiiKiCoAsoooiogqALKKKIqIKgCyiiiKiCoAsoooiogqALKKKIqIKgCyiiiKiCoAsoooiogqALKKKIqIKgCyiiiKiCoAsoooiogqALBOKqtZa29Dttr/U3UObc/0b3AWiCoAs01rxNxsodVG1MCezq0QVAFmmtdz318l126WudUTVmagCIM20lntRNSGiCoAs01ruz+tk+btK7f+tHFz+5G6NCFt5kf6vT2UW1ZmoAiDNtFb85ZZaOLo8v+vByvkD72H4Daz9KjtAVAGQZVorfn/EjB5V/ZPTiCoAskxr0d+2qDrr/a8TkovqTFQBkGZa6/4WRlXXofCiOhNVAKSZ1tK/bVHVdQPX/UZ8z5fcpxtnogqALBNasrv+cd/ynOUJ8w/mD61RLQtRtfI6bcmQH234+CSIKgCyTHbJvlW38Lle12VFFQBMw2SX7Fu19p+1hl98+PhUiCoAskx51WariSoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKoqIKgCyiCqKiCoAsogqiogqALKIKorcNKoOjmZ7+7uwHRzNNvZLBWCLtWazVW3rvy0PjmZ3vnn78Ve/7sB255u3ugoAGEXb25999OUvf+yEv/39t2+/+3PsXykAkOgiqt6+fXt6ejr1/cdf/SqqAIBRXETVmzdvTk9Pp77/6MtfRBUAMIq2tz/78IufX79+fXJycuW+tdY/p7V2PufKmVfOGXKFhb2oAgDGchFVr169Ojk5uXLfllweXRhprV2OL8/psvBaK8/qucMPv/hZVAEAo2h7+7MPPv/pv8O01gZOmJ+5fFb/0StP6SKqAICxXETVf4ZprQ2c0DXzfHz+aNdI12APUQUAjKXt7c/e/+zHly9fvnjxYuW+59O6IXPmZ7bWLufPn7t8dOH680d79h98/pOoAgBGcRFV/+7WWhs+fjnYddZwC1cYckFRBQCMpe3tz9779Ifnz58fHx+v3LfWho+31haOXo5cjq/UdZ2ekeX9+5/9KKoAgFFcRNWzZ8+Oj49X7ltrw8fPC+nyaNec/pGF2Oo6a3kvqgCAsbS9/dm7n3z/r24935RaOXP+ac81h0zrOqXLe5/+IKoAgFFcRNU/b+Y8p84fLIzMDy6fsvLQ8hW6LrJAVAEAY2l7+7O79x/+o1tr7XK/8sGVkxdmntdS19OVI10vt+DdT74XVQDAKC6i6qhDa2358fKDy6cLIwuDKyf0H1r5sWPX3YoqAGAsbW9/dufeg6dPnx4eHk59L6oAgLFcRNWTJ08ODw+nvr97/6GoAgBGcRFVv+8EUQUAjOUiqh49evT48eOp7+/ceyCqAIBRtIOj2Ttfv7pz78HUt7v3H77z9auDo9nYv1IAIFE7Ozs7OJp9+92fO7ApKgBgLG3sGwAA2AWiCgBgA0QVAMAGiCoAgA0QVQAAGyCqAAA2QFQBAGyAqAIA2ABRBQCwAf8DSaEELmjNyW8AAAAASUVORK5CYII=" alt="" /> //js样式
 /**
* Created by Ibokan on 2015/8/26.
*/
function $$(id) {
return document.getElementById(id);
}
var comm = {
setAttr: function (e, strName, strValue) { //e是元素名称 ,,strName是属性名称,,strValue是属性值。。
e.setAttribute(strName, strValue);
},
getAttr: function (e, strName) {
return e.getAttribute(strName);
}
}

 

setAttribute,,,getAttribute,,,,的更多相关文章

  1. JSP内置对象--session对象(getId(),getCreationTime(),getLastAccessedTime(),isNew(),invalidate(),setAttribute(),getAttribute())

    session对象是javax.servlet.http.HttpSession接口的实例,但是不像HttpServletRequest或HttpServletResponse一样,有父接口,他没有父 ...

  2. 在请求中存取属性setAttribute&getAttribute方法

    在请求中保存属性: public void setAttribute(String name,Object o) request.setAttribute("mess"," ...

  3. request:getParameter getAttribute

    转载自:http://www.cnblogs.com/shaohz2014/p/3804656.html 在浏览器地址输入,表示传入一个参数test,值为123 http://localhost:88 ...

  4. request getParameter getAttribute

    在浏览器地址输入,表示传入一个参数test,值为123 http://localhost:8888/Test/index.jsp?test=123 在index.jsp中尝试使用EL表达式取出,代码如 ...

  5. getAttribute和getParameter的区别

    2016年1月19日JSP中getParameter与getAttribute有何区别? ——getParameter得到的都是String类型的.或者是http://a.jsp?id=123中的12 ...

  6. request.getParameter与request.getAttribute()

    这里就request为例,不去考虑session. request对象是javax.servlet.http.HttpServletRequest接口的一个实例,request表示调用JSP页面的请求 ...

  7. Java中getAttribute getParameter 区别

            网上说的不少,发现都是同一篇,汗..... (1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方法 (2)当两个Web组 ...

  8. JSP中getParameter和getAttribute区别

    (1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方法 (2)当两个Web组件之间为链接关系时,被链接的组件通过getParameter ...

  9. getParameter和getAttribute有什么区别

    1.getAttribute是取得jsp中 用setAttribute設定的attribute 2.parameter得到的是string:attribute得到的是object 3.request. ...

随机推荐

  1. jsp页面往mysql里插入中文后数据库里显示乱码

    1.JSP页面乱码 这种乱码的原因是应为没有在页面里指定使用的字符集编码,解决方法:只要在页面开始地方用下面代码指定字符集编码即可,<%@ page contentType="text ...

  2. java运算符

    赋值运算符 int num1=10; int num2=30; System.out.println(num1+num2); 算术运算符 int num=20; System.out.println( ...

  3. 用PowerMock mock final类constructors

    也相对简单,直接贴代码 被测方法 public class EmployeeServiceWithParam { public void createEmployee(final Employee e ...

  4. 重叠I/O模型

    一. 重叠I/O的概念当调用ReadFile和WriteFile时,如果最后一个参数lpOverlapped设置为NULL,那么线程就阻塞在这里,直到读写完指定的数据后,它们才返回.这样在读写大文件的 ...

  5. psp个人软件开发

    为开发人员提供一个PSP工具,简化时间记录工作:同时提供数据使用的工具,帮助开发人提高估算能力.  需求分析: 编号 特性 FEAT01 研发经理能够创建项目.指定或修改项目经理.删除尚未分配工作任务 ...

  6. Groovy解析xml并且注入Project,TestSuite,TestCase级别的custom properties

    import com.eviware.soapui.support.GroovyUtils import groovy.util.XmlParser def groovyUtils = new Gro ...

  7. __attribute__((packed))作用

    1. __attribute__ ((packed)) 的作用就是告诉编译器取消结构在编译过程中的优化对齐,按照实际占用字节数进行对齐,是GCC特有的语法.这个功能是跟操作系统没关系,跟编译器有关,g ...

  8. app接口测试-bug分类

    前段时间在测试一个项目,任务是测试app的API.总结下遇到的问题类型: 1 通过app提交数据,隐形数据有误.(主要通过验证数据库) 比如用户通过app输入工单提交.接口数据中,用户输入的信息都正确 ...

  9. php复习第一章—1.1php 简介

    php语言是构建互联网应用的后端最佳选择 跨平台 性能优越,稳定性强 语法简单,易于上手 丰富完善的技术扩展 LAMP平台成熟稳定,低成本构建 回顾 web 网页本质是一个文本文件,由浏览器解释文件内 ...

  10. Consistent hashing —— 一致性哈希

    原文地址:http://www.codeproject.com/Articles/56138/Consistent-hashing 基于BSD License What is libconhash l ...