javascript定时更换表格背景
<html>
<head>
<title>changePage</title>
</head>
<body>
<table id="pic" cellpadding="0" cellspacing="0" border="1" width="200" height="100" bordercolor="red">
<tr>
<td>picture chanage!</td>
</tr>
</table>
<script type="text/javascript">
<!--
window.onload=function()
{
changePicture();
}
var time=0;
function changePicture(){
time++;
document.getElementById('pic').background="images/"+time+".jpg";
if(time==3)
changePicture1();
else
setTimeout(changePicture,500);
}
function changePicture1(){
document.getElementById('pic').background="images/"+time+".jpg";
time--;
if(time==0)
changePicture();
else
setTimeout(changePicture1,10000); //设定时间
}
-->
</script>
</body>
</html>
相关文档:
要取什么值?
取value:getElementById("STB_433").value;
取状态(是否check):getElementById("STB_433").checked
取ID:getElementById("STB_433").id
...
var checkboxs=document.getElementsByTagName("input");
var i;
for(i=0;i<checkboxs.length;i++)
{
if(checkboxs[i].type=='checkbox')
{ ......
<html>
<head>
<script type="text/javascript">
function tree(treethis){
if (treethis.alt == "+"){
treethis.alt = "-";
document.getElementById("bench").style. ......
5、用 构造函数+原型 定义一个类;同一构造函数可以定义出多个类型
/**
* $define 写类工具函数之二
* @param {Object} constructor
* @param {Object} prototype
*/
function $define(constructor,prototype) {
var c = constructor || function(){};
var p = prototype || {};
r ......
最近这段时间一直在搞前端JavaScript,以前总觉得JS没什么搞头,经过这一段的应用,才发现Js里面的东西真的很深很深的,不然为什么各大门户网站都招一批JS工程师呢。
以下文章为引用李战老哥的《悟透JavaScript》一文,写的实在太好了,就收录了,以做个备用。
引子
& ......
s<!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=gb2312" />
<title>无标题文档< ......