用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";
相关文档:
经常会在js里用到数组,比如 多个名字相同的input, 若是动态生成的, 提交时就需要判断其是否是数组.
if(document.mylist.length != "undefined" ) {} 这个用法有误.
正确的是 if( typeof(document.mylist.length) != "undefined" ) {}
或 if( !isNaN(document.mylist.length) ) {}
typeof ......
The ExternalInterface API
之前我们使用flash调用javascript函数,一般使用这样的方法:
代码:
getURL(“javascript:alert(‘hello zhang-chao.com’);”); //注意字符串 双引号 里面加单引号
但是使用这种方法从flash调用javascript函数仍存在许多困难 ......
js鼠标事件大全2008年01月14日 星期一 08:54一般事件 事件 浏览器支持 描述
onClick IE3|N2|O3 鼠标点击事件,多用在某个对象控制的范围内的鼠标点击
onDblClick IE4|N4|O 鼠标双击事件
onMouseDown IE4|N4|O 鼠标上的按钮被按下了
onMouseUp IE4|N4|O 鼠标按下后,松开时激发的事件
onMouseO ......
屏蔽IE浏览器(也就是IE下不显示)
*:lang(zh) select {font:12px !important;} /*FF,OP可见,特别提醒:由于Opera最近的升级,目前此句只为FF所识别*/
select:empty {font:12px !important;} /*safari可见*/
这里select是选择符,根据情况更换。第二句是MAC上safari浏览器独有的。仅IE7与IE5.0 ......
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 ......