<html>
<head>
<script language="javascript">
function dosome(obj)
{
obj.className = "a1"
}
</script>
<style type="text/css">
.a1 { color:#F00;}
.a1 a {text-decoration:none;color: #F00}
</style>
</head>
<body ><table width="546" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="546" onClick="dosome(this)">1</td>
</tr>
<tr>
<td width="546" onmouseover="dosome(this)"><a href = "163.com">2</a></td>
</tr>
</table>
</body>
</html>
<head>
<script language="javascript">
function dosome(obj)
{
obj.className = "a1"
}
</script>
<style type="text/css">
.a1 { color:#F00;}
.a1 a {text-decoration:none;color: #F00}
</style>
</head>
<body ><table width="546" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="546" onClick="dosome(this)">1</td>
</tr>
<tr>
<td width="546" onmouseover="dosome(this)"><a href = "163.com">2</a></td>
</tr>
</table>
</body>
</html>
a:hover{
color:red;
}
如果想让超联接每隔一秒变一次色,怎么做?
<head>
<script language="javascript">
var _st = window.setTimeout;
window.setTimeout = function(fRef,mDelay)
{
if(typeof fRef =="function")
{
var argu=Array.prototype.slice.call(arguments,2);
var f=(
function(){
fRef.apply(null, argu);
}
);
return _st(f,mDelay);
}
return _st(fRef,mDelay);
}
var flag=true;
function dosome(obj)
{
if(flag)
{
obj.className = "a2";
flag=false;
}
else
{
obj.className = "a1";
flag=true;
}
setTimeout(dosome,1000,obj);
}</script>
<style type="text/css">
.a1 { color:#F00;}
.a2 { color:#00F;}
.a1 a {text-decoration:none;color: #F00}
.a2 a {text-decoration:none;color: #00F}
</style>
</head>
<body ><table width="546" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="546" onClick="dosome(this)">1</td>
</tr>
<tr>
<td width="546" onmouseover="dosome(this)" onmouseout="NotDo()"><a href = "163.com" class=a1>2</a></td>
</tr>
</table>
</body>
</html>
<html>
<head>
<script language="javascript">
var _st = window.setInterval;
window.setInterval = function(fRef,mDelay)
{
if(typeof fRef =="function")
{
var argu=Array.prototype.slice.call(arguments,2);
var f=(
function(){
fRef.apply(null, argu);
}
);
return _st(f,mDelay);
}
return _st(fRef,mDelay);
}
var flag=true;
function dosome(obj)
{
if(flag)
{
obj.className = "a2";
flag=false;
}
else
{
obj.className = "a1";
flag=true;
}
}
function dosomedo(obj)
{
cf=setInterval(dosome,1000,obj);
}
function NotDo()
{
clearInterval(cf);
}</script>
<style type="text/css">
.a1 { color:#F00;}
.a2 { color:#00F;}
.a1 a {text-decoration:none;color: #F00}
.a2 a {text-decoration:none;color: #00F}
</style>
</head>
<body ><table width="546" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="546" onClick="dosome(this)">1</td>
</tr>
<tr>
<td width="546" onmouseover="dosomedo(this)" onmouseout="NotDo()"><a href = "163.com" class=a1>2</a></td>
</tr>
</table>
</body>
</html>
怎么传递了三个参数? 标准用法不是两个?var argu=Array.prototype.slice.call(arguments,2);
是什么意思
var argu=Array.prototype.slice.call(arguments,2);
对传进来的参数进行截断2个
Array.prototype.slice这句的意思是数组的截断函数而不是字符串的截断函数
call调用
arguments为参数对象
2截取几个
标准的用法是两个参数
上面说的“是三个”的意思是在这里是三个
:)
就是
var argu=Array.prototype.slice.call(数组—— dosome,1000); 吧那后面的obj干吗用,给function dosome(obj)当参数?怎么重载,苯,不大明白...