Arnold9000
Jul 6th 2008, 7:43 am
Hi, I'm trying to do a javascript/css animation.
The address is www.bowserlaw.com/indextest.asp
If you click on the see video button to the right underneath the guy's picture, you'll see a video suddenly appear (because I set it's display property from "none" to "display"). The video is in an iframe linking to another address.
What I want to do is to not make the video appear immediately, but I would rather have it slowly appear (within a second so) and slowly bump the content beneath it down as the iframe slowly gains height. Here's the relevant code:
<script language="javascript">
function donothing () {
}
function showmovie (){
document.getElementById('movie').style.display='block';
document.getElementById('movieframe').style.height='0px';
document.getElementById('movieframe').src='http://progressive.facesmedia.com/standardvideo/bin-release/StandardVideo.html#video_id=1057';
for (var count=1; count<251; count++){
var height=count+"";
document.getElementById('movie').style.height=height+'px';
document.getElementById('movieframe').style.height=height+'px';
setTimeout("donothing();",10);
}
}
function hidemovie (){
document.getElementById('movieframe').src='blank.html';
for (var count=250; count<0; count--){
var height=count+"";
document.getElementById('movie').style.height=height+'px';
document.getElementById('movieframe').style.height=height+'px';
setTimeout("donothing()",10);
}
document.getElementById('movieframe').style.display='none';
}
</script>
html to invoke the showmovie function
<a href="#" onclick="showmovie();"><img src="/images/greenclickwh.gif" border="0" alt="Tell a Lawyer about your DWI / Criminal Law Case or Personal Injury case"></a>
The html code for the movie and iframe, including a button to hide the movie and iframe
<div id="movie" style="display:none; padding-bottom:8px;">
<iframe id="movieframe" allowTransparency="true" frameborder="0" width="490"></iframe>
<a href="#" onclick="hidemovie();"<img src="/images/closebutton.gif" border="0" alt="Tell a Lawyer about your DWI / Criminal Law Case or Personal Injury case" style="position:relative; top:-240px; left:425px; z-index:5;"></a>
</div>
Obviously, I'm trying to increase the size of the iframe by one pixel, 250 different times in a loop, using the setTimeout function to delay the iterations of the loop and control the speed with which it increases the iframe size, and bumps the content underneath it down.
What happens instead, it that it delays for the total time of the loop and THEN immediately displays the iframe, rather than gradually displaying it. I know the loop is iterating properly because I put a print statement in there, and it prints out 250 times. There's something wrong with the way I am telling it what size to be in that loop.
The only error message I get in the error console is:
uncaught exception: permission denied to call method location.toSting
This seems to relate to me setting the location property to the appropriate url after the iframe's display property is set to display
I hope I described the problem clearly and comprehensively and I'm hoiping someone can help. Thanks in advance.
The address is www.bowserlaw.com/indextest.asp
If you click on the see video button to the right underneath the guy's picture, you'll see a video suddenly appear (because I set it's display property from "none" to "display"). The video is in an iframe linking to another address.
What I want to do is to not make the video appear immediately, but I would rather have it slowly appear (within a second so) and slowly bump the content beneath it down as the iframe slowly gains height. Here's the relevant code:
<script language="javascript">
function donothing () {
}
function showmovie (){
document.getElementById('movie').style.display='block';
document.getElementById('movieframe').style.height='0px';
document.getElementById('movieframe').src='http://progressive.facesmedia.com/standardvideo/bin-release/StandardVideo.html#video_id=1057';
for (var count=1; count<251; count++){
var height=count+"";
document.getElementById('movie').style.height=height+'px';
document.getElementById('movieframe').style.height=height+'px';
setTimeout("donothing();",10);
}
}
function hidemovie (){
document.getElementById('movieframe').src='blank.html';
for (var count=250; count<0; count--){
var height=count+"";
document.getElementById('movie').style.height=height+'px';
document.getElementById('movieframe').style.height=height+'px';
setTimeout("donothing()",10);
}
document.getElementById('movieframe').style.display='none';
}
</script>
html to invoke the showmovie function
<a href="#" onclick="showmovie();"><img src="/images/greenclickwh.gif" border="0" alt="Tell a Lawyer about your DWI / Criminal Law Case or Personal Injury case"></a>
The html code for the movie and iframe, including a button to hide the movie and iframe
<div id="movie" style="display:none; padding-bottom:8px;">
<iframe id="movieframe" allowTransparency="true" frameborder="0" width="490"></iframe>
<a href="#" onclick="hidemovie();"<img src="/images/closebutton.gif" border="0" alt="Tell a Lawyer about your DWI / Criminal Law Case or Personal Injury case" style="position:relative; top:-240px; left:425px; z-index:5;"></a>
</div>
Obviously, I'm trying to increase the size of the iframe by one pixel, 250 different times in a loop, using the setTimeout function to delay the iterations of the loop and control the speed with which it increases the iframe size, and bumps the content underneath it down.
What happens instead, it that it delays for the total time of the loop and THEN immediately displays the iframe, rather than gradually displaying it. I know the loop is iterating properly because I put a print statement in there, and it prints out 250 times. There's something wrong with the way I am telling it what size to be in that loop.
The only error message I get in the error console is:
uncaught exception: permission denied to call method location.toSting
This seems to relate to me setting the location property to the appropriate url after the iframe's display property is set to display
I hope I described the problem clearly and comprehensively and I'm hoiping someone can help. Thanks in advance.