cssText 和 this
一、cssText
元素.style.width = '200px'; ==> 元素.style.cssText = 'width:200px;height:200px;'
二、this
1、含义:指的是调用当前方法(函数的那个对象)
2、调用
function fn1(){ this }
1) fn1() this => window (直接调用)
2) oDiv.onclick = fn1; this => oDiv (事件调用)
3) oDiv.onclick = function (){ (匿名调用)
this ( this => oDiv )
fn1(); ( fn1()里的this => window )
}
cssText 和 this的更多相关文章
- JavaScript 学习笔记——cssText
平常编写代码,更改一个元素样式的时候,自己都是用 obj.style.width = "200px"; obj.style.position = "absolute&qu ...
- 浅谈cssText
给一个HTML元素设置css属性,如 var head= document.getElementById("head"); head.style.width = "200 ...
- CSSText属性批量修改样式
给一个HTML元素设置css属性 var head= document.getElementById("head");head.style.width = "200p ...
- CSS之cssText
更改元素样式 <div style="width:100px;height:100px;text-align:center;line-height:100px;"> T ...
- cssText在 IE6/7/8和chrome/Firefox/IE9+的不同
一,结尾没有分号 <div style="font-size:14px;">test</div> <script type="text/ja ...
- cssText
cssText 的本质就是设置 HTML 元素的 style 属性值 cssText 的方便之处在于一次可以写很多属性,而且变更 CSS 样式不必变 JS 代码,只需变样式字符串.但它有个缺点,就是它 ...
- 巧用cssText属性批量操作样式
给一个HTML元素设置css属性,如 1 2 3 4 var head= document.getElementById("head"); head.style.width = & ...
- 用JS查看修改CSS样式(cssText,attribute('style'),currentStyle,getComputedStyle)
CSS样式定义方法 大家都知道,在为HTML设置样式的时候,通常有三种方法:内联样式,内部样式表,外部样式表. 1.内联样式: 内联样式表就是在HTML元素中的行内直接添加style属性. <d ...
- cssText设置css样式
js中用cssText设置css样式 (2012-08-21 10:40:22) 转载▼ 标签: js 如果网页中一个 id为“no”的标签,暂且当div标签来tell:想要在js中设置这个div ...
- 用cssText属性批量操作样式
给一个HTML元素设置css属性,如 var head= document.getElementById("head"); head.style.width = "200 ...
随机推荐
- PAT (Advanced Level) 1043. Is It a Binary Search Tree (25)
简单题.构造出二叉搜索树,然后check一下. #include<stdio.h> #include<algorithm> using namespace std; +; st ...
- hihoCoder 1252 Kejin Game
2015 ACM / ICPC 北京站 D题 网络最大流 和同学讨论了一会儿,还是Xiang578机智... ... /* ************************************** ...
- Flocker 做为后端存储代理 docker volume-driver 支持
docker Flocker https://github.com/ClusterHQ/flocker/ 文档: https://docs.clusterhq.com/en/latest/docker ...
- fork,exec,source
http://alsww.blog.51cto.com/2001924/1113112 http://stackoverflow.com/questions/1127502/start-stop-da ...
- Delphi xe7并行编程快速入门(转)
源:http://blog.csdn.net/henreash/article/details/41315183 现在多数设备.计算机都有多个CPU单元,即使是手机也是多核的.但要在开发中使用多核的优 ...
- ios开发证书,描述文件,bundle ID的关系
苹果为了控制应用的开发与发布流程,制定了一套非常复杂的机制.这里面的关键词有:个人开发者账号,企业开发者账号,bundle ID,开发证书,发布证书(又叫"生产证书"),开发描述文 ...
- acm--统计错误数
题目描述 题目地址:http://www.nowcoder.com/practice/67df1d7889cf4c529576383c2e647c48?tpId=49&tqId=29276&a ...
- vs2008安装opencv2.4.6
最近安装opencv2.4.6,发现犯了一个很愚蠢的错误,在此记录一下. opencv的头文件包含应该位于build文件夹内,而我误将opencv文件夹下的include包含了进去,造成无法找到头文件 ...
- CodeForces 652C Foe Pairs
只要计算每个位置最多能到哪个位置,累加即可,DP从后往前预处理一下每个位置到达的最远位置. 有坑点:输入的时候如果同一个点出发的,需要保存最小值. #include<cstdio> #in ...
- iOS开发——modifying the autolayout engine from a background thread
很多时候,我们需要用到多线程的东西,比如红外线检测是否有人经过.这种情况需要搞个子线程在后台不断的检测,这个线程可能是第三方提供的,你调用它给的方法,然后显示提示框的时候,问题就来了. 提示信息:Th ...