用javascript动态设置css样式的值
css控制位置:
纯数字
el.style.posLeft = 0;
el.style.posTop = 0;
数字+单位
el.style.left = "0px";
el.style.top = "0px";
css控制元素的样式:
document.getElementById("para").style.fontWeight ="bold";
或(其他也是这样):
document.getElementById("para").className ="strong";
相关文档:
一直以来对if(obj)的用法有点疑惑,不知道如果obj是一个对象的时候(而不是简单的true/false),该怎么执行。在什么情况下该为true,什么情况下又该为false.
通过下面的小测试,了解到,当obj="",obj=undefined,obj=null,obj=NaN 的时候返回false,obj不为空的时候则返回true。
var obj ;//undefined
if(ob ......
#dh
{
width:1003px;
height:36px;
background-image:url(images/mmain_03.gif)
}
#dh li
{
height:30px;
width:110px;
float:left;
list-style:none;
text-align:center;
margin:7px;
padding:5px;
}
#dh li a:link
{
font-size:16 ......
<!-- 学习自javaeye的文章 请转贴者注自出处 learner:nilinfa -->
<HTML>
<script>
/*定义一个新的对象*/
var emptyObject1 = {};
/*定义一个新的对象*/
var emptyObject2 = new Object();
/*定义一个新的对象,键值对应*/
v ......
1.一行三列
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
<head><title>css布局:一行三列</title>
<link rel="stylesheet" href ......
function class1(){
alert("class1");
};
function class2(){
alert("class2");
}
class2.prototype=class1.prototype;
var obj=new class2();
alert(obj instanceof class1);
alert(obj instanceof class2);
alert(class2.prototype.constructor);
class2.prototype.constructor(); ......