FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

how to resize the mediaplayer as i shrink or enlarge

 


afracsass
I'm wondering how can i resize the mediaplayer video size on the web browser as i shrink or enlarge the browser size.

using javascript i wrote:
Code:

<script>
document.write('<embed src="xxx.wmv" width="'+document.body.offsetWidth+'" height="'+document.body.offsetWidth*1.5+' >');
</script>


But this code just works when i click refresh.
Refresh makes the video return to the beginning.

Can anyone tell me how to make the video size follow the browser size without disturbing the video playing?

thanks,
LukeakaDanish
This is probably what you want:

inside the body tag:

Code:


onresize="changeSize()"



inside the document.write statement:

Code:
id="movie"


inside a <script> tag in your header

Code:

function changeSize() {
document.getElementById('movie').style.width = document.body.offsetWidth;
document.getElementById('movie').style.height = document.body.offsetWidth*1.5;
}



BTW...i recomend writing the width and height attributes as CSS rather than HTML attributes...
afracsass
Thank you so much for your help. It works great.
CSS, I need to learn some more about CSS. Thank you for your advice.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.