Jump to content

[SOLVED] <center> with javascript


aliento

Recommended Posts

I want to center the result of the function and i cant center the div :

<script type="text/javascript">
function load_movie()
{
var so = new SWFObject('movie/player.swf','mpl','360','260','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&file=/movie/movie.flv&autostart=true');
so.write('content');
}
</script>

The div :

<div id="content" style=" width:449px;height:230px; overflow:hidden;">

Any advise?

Link to comment
https://forums.phpfreaks.com/topic/130831-solved-with-javascript/
Share on other sites

try this:

 

<script type="text/javascript">
function load_movie()
{
var so = new SWFObject('movie/player.swf','mpl','360','260','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('align','center');
so.addParam('salign','middle');
so.addParam('flashvars','&file=/movie/movie.flv&autostart=true');
so.write('content');
}
</script>

 

here is a full reference; if the above code does not work:

 

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701&sliceId=1

Or:

<script type="text/javascript">
function load_movie()
{
var so = new SWFObject('movie/player.swf','mpl','360','260','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&file=/movie/movie.flv&autostart=true');
so.write('content');
document.getElementById('content').style.textAlign = 'center';
}
</script>

Or:

<script type="text/javascript">
function load_movie()
{
var so = new SWFObject('movie/player.swf','mpl','360','260','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&file=/movie/movie.flv&autostart=true');
so.write('content');
document.getElementById('content').style.textAlign = 'center';
}
</script>

 

This works great, thank you!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.