日期:2014-05-16 浏览次数:20350 次
function action(event){
var thisId = event.currentTarget.id;
var littleBoxs = document.getElementById("box").childNodes;
while(parseInt(getWidth(thisId)) < 350){
for(var i = 0;i < littleBoxs.length;i++){
if(littleBoxs[i].id != null){
if(getNumber(littleBoxs[i].id) != getNumber(thisId)){
downWidth(littleBoxs[i].id);
}
}
}
addWidth(thisId);
doNothing();
}
}
function doNothing() {
setTimeout("doNothing()",100);
}
<!doctype html>
<html>
<body>
<script type="text/javascript">
temp()
function temp()
{
var hr=document.createElement("hr");
document.getElementsByTagName("body")[0].appendChild(hr);
//do sth here
setTimeout("temp()",1000);
}
</script>
</body>
</html>
while(parseInt(getWidth(thisId)) < 350){ for(var i = 0;i < littleBoxs.length;i++){ if(littleBoxs[i].id != null){ if(getNumber(littleBoxs[i].id) != getNumber(thisId)){ downWidth(littleBoxs[i].id); } } } addWidth(thisId); doNothing(); }
function action(event){
var thisId = event.currentTarget.id;
var littleBoxs = document.getElementById("box").childNodes;
doNothing(thisId,littleBoxs);
}
function doNothing(thisId,littleBoxs) {
if(parseInt(getWidth(thisId)) < 350){
for(var i = 0;i < littleBoxs.length;i++){
if(littleBoxs[i].id != null){
if(getNumber(littleBoxs[i].id) != getNumber(thisId)){
downWidth(littleBoxs[i].id);
}
}
}
addWidth(thisId);
setTimeout(function(thisId,littleBoxs){doNothing(thisId,littleBoxs)},100);
}
}