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
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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.