javascript+css 实现tab功能
<!---------<html>
<head>
<style type="text/css">
.tabheader table {
border-collapse: collapse; /* for IE */
border-spacing: 0; /* for N6 */
}
.tabheader table tr td {margin:0;padding:0;border-width:0}
.tabheader .close {
border-style: solid;
border-width: 1px;
border-color: #000;
background-color: #d0d0d0;
margin:0;
padding: 0.5em;
white-space: nowrap;
}
.tabheader .open {
border-style: solid;
border-width: 1px;
border-color: #000 #000 #fff #000;
background-color: white;
margin:0;
padding: 0.5em;
white-space: nowrap;
}
.tabheader .spc {
border-style: solid;
border-width: 1px 0 1px 0;
border-color: #fff #fff #000 #fff;
margin:0;
padding: 0.5em;
white-space: nowrap;
}
.tabheader a {text-decoration: none;}
.tabbody {
border-color: black;
border-style: solid;
border-width: 0 1px 1px 1px;
padding: 1em;
}
</style>
<script language="JavaScript">
<!--
function seltab(bpref, hpref, id_max, selected) {
if (! document.getElementById) return;
for (i = 0; i <= id_max; i++) {
if (! document.getElementById(bpref + i)) continue;
if (i == selected) {
document.getElementById(bpref + i).style.visibility = "visible";
document.getElementById(bpref + i).style.position = "";
document.getElementById(hpref + i).className = "open";
} else {
&n
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
调用JavaScript文件
用作导航栏
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> ......
<style type="text/css">
/*
从上往下渐变
*/
body
{
FILTER:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#003C9F,endColorStr=white);
}
/*
从左上至右下渐变
*/
body
{
background-color:skyblue;
FILTE ......
在javascript中用法举例
var rule = /^\d+$/;
if(!rule.test(addform.rmb_price.value)) {
alert('rmb_price must be number');
addform.rmb_price.focus();
return false;
}
在php中用法举例
$aa = "/^\d+$/";
if(preg_match($aa, "111")) {
echo "found";
}
在java中用法举例 ......
Css代码
1.line-height:24px;
line-height:24px;
使用固定宽度的容器并且需要一行垂直居中时,使用 line-height 即可(高度与父层容器一致),更多的垂直居中总结可以看这里。
清除容器浮动
Css代码
1.#main {
2. overflow:hidden;
3.}
#ma ......