<style>
.haveMsg1
{
margin-top:2px;
margin-left:2px;
margin-bottom:-2px;
margin-right:-2px;
}
.haveMsg0
{
margin-top:0px;
margin-left:0px;
margin-bottom:0px;
margin-right:0px;
}
</style>
<img src="a1.jpg" id="img1">
<img src="a2.jpg" id="img2">
<script>
var action,obj
function flash()
{
obj.className=obj.className=="haveMsg0"?"haveMsg1":"haveMsg0"
}
function begin(img)
{
obj=img
stop()
action=window.setInterval("flash()",200);
}
function stop()
{
if (action!=null)
window.clearInterval(action);
}</script>
<input type="button" value="第一个闪动" onclick="begin(img1)">
<input type="button" value="第二个闪动" onclick="begin(img2)">
<input type="button" value="停止闪动" onclick="stop()">
.haveMsg1
{
margin-top:2px;
margin-left:2px;
margin-bottom:-2px;
margin-right:-2px;
}
.haveMsg0
{
margin-top:0px;
margin-left:0px;
margin-bottom:0px;
margin-right:0px;
}
</style>
<img src="a1.jpg" id="img1">
<img src="a2.jpg" id="img2">
<script>
var action,obj
function flash()
{
obj.className=obj.className=="haveMsg0"?"haveMsg1":"haveMsg0"
}
function begin(img)
{
obj=img
stop()
action=window.setInterval("flash()",200);
}
function stop()
{
if (action!=null)
window.clearInterval(action);
}</script>
<input type="button" value="第一个闪动" onclick="begin(img1)">
<input type="button" value="第二个闪动" onclick="begin(img2)">
<input type="button" value="停止闪动" onclick="stop()">
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.haveMsg1
{
margin-top:0px;
margin-left:-2px;
margin-bottom:-2px;
margin-right:2px;
}
.haveMsg0
{
margin-top:0px;
margin-left:0px;
margin-bottom:0px;
margin-right:0px;
}
.haveMsg2
{
margin-top:0px;
margin-left:2px;
margin-bottom:-2px;
margin-right:-2px;
}
</style>
<title>无标题文档</title>
</head><body><img src="a1.jpg" id="img1">
<img src="a2.jpg" id="img2">
<script>
var obj
var action;
var last="";
function flash()
{
switch(obj.className)
{
case "haveMsg1":
obj.className="haveMsg0";
last="haveMsg1";
break;
case "haveMsg2":
obj.className="haveMsg0";
last="haveMsg2";
break;
case "haveMsg0":
if(last=="haveMsg1")
obj.className="haveMsg2";
else
obj.className="haveMsg1";
break;
default:
obj.className="haveMsg2";
}
}
function begin(img)
{
obj=img;
stop();
action=window.setInterval("flash()",300);
}
function stop()
{
if (action!=null)
window.clearInterval(action);
}</script>
<input type="button" value="第一个闪动" onclick="begin(img1)">
<input type="button" value="第二个闪动" onclick="begin(img2)">
<input type="button" value="停止闪动" onclick="stop()">
</body>
</html>