<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!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 runat="server">
<title>无标题页</title> <script src="jquery-1.4.1-vsdoc.js" type="text/javascript"></script> <script type="text/javascript">
var divindex=1;
function dianji(id){
document.getElementById(id).style.right="300px";
document.getElementById(id).style.zIndex=divindex+1;
divindex=divindex+1;
var d=0;
bw1= self.setInterval(fangfa(id,d),1);
}
function fangfa(id,d){
var a=document.getElementById(id).style.left;
a=a.substr(0,a.length-2);
var b = (a*1)+1;
document.getElementById(id).style.left=b+"px";
if(d>300){
self.clearInterval(bw1);
}
d++;
alert(d);
}
</script></head>
<body>
<form id="form1" runat="server">
<div onclick="dianji('div1')">
div1
</div>
<div onclick="dianji('div2')">
div2
</div>
<div onclick="dianji('div3')">
div3
</div>
<div style="overflow: hidden; width: 300px; height: 300px; position: relative">
<div id="div1" style="z-index: 1; position: absolute; float: left; background-color: Maroon;
width: 300px; height: 300px">
div1
</div>
<div id="div2" style="z-index: 1; position: absolute; float: left; background-color: Yellow;
width: 300px; height: 300px">
div2
</div>
<div id="div3" style="z-index: 1; position: absolute; float: left; background-color: Fuchsia;
width: 300px; height: 300px">
div3
</div>
</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title> <script src="jquery-1.4.1-vsdoc.js" type="text/javascript"></script> <script type="text/javascript">
var divindex=1;
function dianji(id){
document.getElementById(id).style.right="300px";
document.getElementById(id).style.zIndex=divindex+1;
divindex=divindex+1;
var d=0;
bw1= self.setInterval(fangfa(id,d),1);
}
function fangfa(id,d){
var a=document.getElementById(id).style.left;
a=a.substr(0,a.length-2);
var b = (a*1)+1;
document.getElementById(id).style.left=b+"px";
if(d>300){
self.clearInterval(bw1);
}
d++;
alert(d);
}
</script></head>
<body>
<form id="form1" runat="server">
<div onclick="dianji('div1')">
div1
</div>
<div onclick="dianji('div2')">
div2
</div>
<div onclick="dianji('div3')">
div3
</div>
<div style="overflow: hidden; width: 300px; height: 300px; position: relative">
<div id="div1" style="z-index: 1; position: absolute; float: left; background-color: Maroon;
width: 300px; height: 300px">
div1
</div>
<div id="div2" style="z-index: 1; position: absolute; float: left; background-color: Yellow;
width: 300px; height: 300px">
div2
</div>
<div id="div3" style="z-index: 1; position: absolute; float: left; background-color: Fuchsia;
width: 300px; height: 300px">
div3
</div>
</div>
</form>
</body>
</html>
解决方案 »
- js实现,获取同级别的某个结点
- 有个setTimeout问题困扰了好久,请好心人看看
- EasySlider发布,顺便散分祝大家新年快乐!
- 求救!JS下拉菜单问题,晕了一个上午了
- 使用js控制checkbox选择数目如何实现 在线等。20分
- textarea 换行的问题, 请教大侠
- 菜鸟问题,eval怎么把一个字符串解成一个数组?
- 求十个常用的正则表达式:1、只能输入英文+数字......
- 求救!!高难度问题,关于“另存为”,不是保存网页那么简单
- javascript实现打印功能
- extjs editorGridPanel数据拖动问题.
- IE6下PNG透明处理之后引发的一些问题,你们有研究过吗?
<!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 runat="server">
<title>无标题页</title> <script src="jquery-1.4.1-vsdoc.js" type="text/javascript"></script> <script type="text/javascript">
var divindex=1;
function dianji(id){
document.getElementById(id).style.right="300px";
document.getElementById(id).style.zIndex=divindex+1;
divindex=divindex+1;
var d=0;
bw1= self.setInterval("fangfa('"+id+"',"+d+")",1);
}
function fangfa(id,d){
var a=document.getElementById(id).style.left;
a=a.substr(0,a.length-2);
var b = (a*1)+1;
document.getElementById(id).style.left=b+"px";
if(d>300){
self.clearInterval(bw1);
}
d++;
//alert(d);
}
</script></head>
<body>
<form id="form1" runat="server">
<div onclick="dianji('div1')">
div1
</div>
<div onclick="dianji('div2')">
div2
</div>
<div onclick="dianji('div3')">
div3
</div>
<div style="overflow: hidden; width: 300px; height: 300px; position: relative">
<div id="div1" style="z-index: 1; position: absolute; float: left; background-color: Maroon;
width: 300px; height: 300px">
div1
</div>
<div id="div2" style="z-index: 1; position: absolute; float: left; background-color: Yellow;
width: 300px; height: 300px">
div2
</div>
<div id="div3" style="z-index: 1; position: absolute; float: left; background-color: Fuchsia;
width: 300px; height: 300px">
div3
</div>
</div>
</form>
</body>
</html>
楼主,帮你搞定
bw1 = self.setInterval(function () { fangfa(id, d) }, 1);