SAM, did you know that Brendan Eich wanted JavaScript to be very much
like AppleScript (hypertalk IIRC, by then) ?
Here's my iframe-resizing demo:
http://jorgechamorro.com/cljs/078/
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Efecto Persiana</title>
<meta name="generator" content="TextMate
http://macromates.com/">
<meta name="author" content="(e-mail address removed)">
<!-- Date: 2009-08-27 -->
</head>
<body style="background:gray; text-align:center;">
<h3>Tested in Safari, Chrome, Opera, FireFox (MacOSX) and iCab 3.0.5
(MacOS9), not tested in any IEs</h3>
<iframe id="idIframe" src="
http://google.com" width="900"
height="500"></iframe>
<script type="text/javascript">
(function () {
function efecto (e) {
var eStyle= e.style;
var speed= 33;
eStyle.overflow= "hidden";
var orderedSetOfStyleProperties= [ "padding-top", "height", "padding-
bottom" ];
var saveStylesValues= {};
(function f () {
var name, valor, repeat= false;
var n= orderedSetOfStyleProperties.length;
while (n--) {
name= orderedSetOfStyleProperties[n];
if (!saveStylesValues.hasOwnProperty(name)) {
//save the original element's style values
saveStylesValues[name]= eStyle[name];
}
valor= parseInt(document.defaultView.getComputedStyle
(e,null).getPropertyValue(name), 10);
valor-= valor/4;
if ((valor < 1) || (valor !== valor)) {
eStyle[name]= 0;
} else {
repeat= true;
eStyle[name]= valor+ "px";
break;
}
}
if (repeat) {
setTimeout(f, speed);
} else {
setTimeout(function () {
eStyle.display= "none";
setTimeout(function () {
for (var name in saveStylesValues) {
if (saveStylesValues.hasOwnProperty(name)) {
eStyle[name]= saveStylesValues[name];
}
}
eStyle.display= "";
setTimeout(function () { efecto(e); }, 1500);
}, 500);
}, speed);
}
})();
}
efecto(document.getElementById('idIframe'));
})();
</script>
</body>
</html>
Regards,