I want to be able to shrink a box from the corners inward dynamically when a button is pressed. Here is my code so far:
function div_collapse_from_corners(shrinkingbox)
{
var test = open('test.htm', 'test', 'width=200, height=200')
styleObj = document.getElementById(shrinkingbox).style
test.document.write(styleObj.left+1)
test.document.write(styleObj.top)
test.document.write(shrinkingbox)
while((styleObj.width >= 1) || (styleObj.height >= 1))
{
styleObj.top = styleObj.top + 1
styleObj.left = styleObj.left + 1
styleObj.width = styleObj.width - 2
styleObj.height = styleObj.height - 2
}
}
And I call it like this:
<img onclick="div_collapse_from_corners('box');" ....>
New window opens up with:
1box
Any suggestions? I am using percentages for all DIV parameters, left, top, width, and height if that makes any difference.
function div_collapse_from_corners(shrinkingbox)
{
var test = open('test.htm', 'test', 'width=200, height=200')
styleObj = document.getElementById(shrinkingbox).style
test.document.write(styleObj.left+1)
test.document.write(styleObj.top)
test.document.write(shrinkingbox)
while((styleObj.width >= 1) || (styleObj.height >= 1))
{
styleObj.top = styleObj.top + 1
styleObj.left = styleObj.left + 1
styleObj.width = styleObj.width - 2
styleObj.height = styleObj.height - 2
}
}
And I call it like this:
<img onclick="div_collapse_from_corners('box');" ....>
New window opens up with:
1box
Any suggestions? I am using percentages for all DIV parameters, left, top, width, and height if that makes any difference.