用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";
相关文档:
#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 ......
可以控制列表按日期以及按字数排序.升或者降序.
代码简单封装,按一定的格式调用即可。
代码写的比较繁琐,很多方法用的很原始...
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......
if(true)
{
var color="blue";
//在java,php,c#等语言中是有块作用域的,变量color在外面是不可以访问的,但是在javascript在括号外是可以访问的
}
alert(color);//"blue"
for(var i=0;i<10;i++)
{
alert(i);
}
alert(i);//“10”外部可以访问 ......
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(); ......