用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 ......
.equal {
margin-bottom:-32767px;
padding-bottom:32767px;
}
.left{
float:left;
margin-left:5px;
overflow:hidden;
width:295px;
}
.right {
float:right;
overflow:hidden;
width:245px;
}
<div class=’left equal’>数据任意长度,可以自行copy很长一断来测试</div>
......
function sAlert(msg,boxtype,func,msgtitle)
sAlert('信息内容',1,'','信息标题')
@msg:提示信息内容
@boxtype:1为弹出框,2为确认框,3为提示框
@func:点确认时执行的函数
@title:信息框标题文字内容
只有msg是必须的,后面的参数可以省略。如果中间的参数为空则在对应位置上''或者 ......
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”外部可以访问 ......