kv79 Posted March 30, 2009 Share Posted March 30, 2009 hi allthanks advance this is not working, I really don know why <script type="text/javascript">var _screen = screen.availWidth;var _width = 495;var _left = ((_screen/2)-_width);document.getElementById('movie').style.left='100px';</script> <style type="text/css"> div.movie, body, p { position:absolute; } p.underline, p , h1 , h2 , u { position:absolute; left:5px; width:100px; height:100px; overflow:hidden; } p.underline{text-decoration:underline;} body { margin:0; } body {background-color:#000;} </style></head><body> <div id="movie" class="movie" > <embed src="pre_loader.swf" width="991" height="550" /> </div> </body> Link to comment Share on other sites More sharing options...
kv79 Posted March 30, 2009 Author Share Posted March 30, 2009 And I want to replace first one with second but it seems that it's not workingdunno why document.getElementById('movie').style.left='100px'; document.getElementById('movie').style.left=_left + 'px'; Link to comment Share on other sites More sharing options...
jesh Posted March 30, 2009 Share Posted March 30, 2009 If you were to alert "_left", you'll probably get "NaN" and I'm guessing this would be because you have a typo here: var _screen = screen.avilWidth; Link to comment Share on other sites More sharing options...
jeffman Posted March 30, 2009 Share Posted March 30, 2009 Are you sure you want the screen width? That tells you nothing about the window width. Link to comment Share on other sites More sharing options...
kv79 Posted March 30, 2009 Author Share Posted March 30, 2009 expain plz, how do you mean its nothing telling me ?You can show your window screen with width alert('screen.availWidth); but can't pass that that value to variable dunno why Link to comment Share on other sites More sharing options...
jeffman Posted March 30, 2009 Share Posted March 30, 2009 Take the quotation mark out of your alert, and it should work.The screen width refers to the total width of the monitor. That is not the same as your window. If the user changes the size of the window, then the window will be smaller than the screen.If you are simply trying to center your movie, there are easier ways that do not require Javascript. Link to comment Share on other sites More sharing options...
kv79 Posted March 31, 2009 Author Share Posted March 31, 2009 hi OK, what is that other way ? Link to comment Share on other sites More sharing options...
jeffman Posted March 31, 2009 Share Posted March 31, 2009 <style type="text/css"> .movie { width: 991px; margin: 0 auto; }</style> Link to comment Share on other sites More sharing options...
kv79 Posted April 2, 2009 Author Share Posted April 2, 2009 Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.