tinfanide
08-18-2011, 12:39 PM
<!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=utf-8" />
<title>Untitled Document</title>
<script>
window.onload = function(){h = parseInt(document.getElementById("div1").style.height);}
var t;
function addHeight(openAccordionID){
clearInterval(t);
document.getElementById(openAccordionID).style.height = h+"px";
h+=1;
t = setInterval("addHeight('"+openAccordionID+"')",10);
for(var x=1; x<h; x++)
if(h%(x*100)==0){clearInterval(t);}
}
</script>
</head>
<body>
<div id="div1" onclick="addHeight(this.id)" style="width: 200px; height: 20px; background-color: yellow;">Increase Height</div>
</body>
</html>
How can I still use the parameter "openAccordionID" in the blue-highlighted part? I tried, but it failed.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
window.onload = function(){h = parseInt(document.getElementById("div1").style.height);}
var t;
function addHeight(openAccordionID){
clearInterval(t);
document.getElementById(openAccordionID).style.height = h+"px";
h+=1;
t = setInterval("addHeight('"+openAccordionID+"')",10);
for(var x=1; x<h; x++)
if(h%(x*100)==0){clearInterval(t);}
}
</script>
</head>
<body>
<div id="div1" onclick="addHeight(this.id)" style="width: 200px; height: 20px; background-color: yellow;">Increase Height</div>
</body>
</html>
How can I still use the parameter "openAccordionID" in the blue-highlighted part? I tried, but it failed.