<!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. android 通过WiFi进行adb调试

    第一种方式: 1.把Android SDK的下的 platform-tools 目录 加入到系统的path变量中 打开cmd命令行 输入adb 显示如下图则为设置成功 2.打开手机 下载一个叫WiFi ...

  2. 面向对象的JavaScript

    多态 多态背后的思想是将"做什么"和"谁去做,怎样去做"分离开来,也就是将"不变的事物"与"可变的事物"分离开来. 其最 ...

  3. sql修改字段名称

    EXEC sp_rename 'RPersonalityColor.[PTF_UPDATE_DT]','PTC_UPDATE_DT','COLUMN'; RPersonalityColor.[PTF_ ...

  4. Unhandled exception at 0x........ in XXXX.exe: 0xC0000005:错误

    对于C++初学者或粗心者,很容易犯如下图所示错误:     那么该错误是由什么造成的呢?   答案无疑只有一个,即:读取了本该没有的值或者地址.   那么如何解决呢?   第一件事,检查下你传入的参数 ...

  5. 最近用到js筛选一个url的域名部分(草创)

    var TLD = ['com','net','org','gov','edu','mil','biz','name','info','mobi','cn','hk']; var host = ''; ...

  6. SimpleAdapter的使用

    SimpleAdapter的使用       SimpleAdapter是一个简单的适配器,该适配器也继承了BaseAdapter,对于布局是固定而言,使用简单适配器开发时非常简单了,由于Simple ...

  7. iis express 局域网访问

    查找到配置文件添加一条绑定局域网可访问的IP地址即可: 事例: <site name="Join.Lims.Mob(11)" id="19"> &l ...

  8. Xcode下搭建opencv环境碰到的一些问题

    写了一学期py-opencv了都快结束了突然又要折腾起c++下来,真实给自己跪了,不过环境基本都搞定了,中间碰到了一些问题这里总结一下: usr/local/include和usr/local/lib ...

  9. IOS百度地图获取所在的城市名称

    笔者的app要实现定位所在省和城市名称,借此总结巩固一下! @interface VenueListVC : BasePageTableViewVC<BMKLocationServiceDele ...

  10. X删除数据表的新用法

    删除数据表,可以这样进行,以前傻不拉唧的用sql去手动删除.             DAL dal = ...             dal.Db.CreateMetaData().SetSche ...