使用javascript定位flash对象
如果浏览器是internet eplorer,我想用code使用javascript定位flash对象,javascript,css,positioning,flash,Javascript,Css,Positioning,Flash,如果浏览器是internet eplorer,我想用codedocument.getElementById(“flashobj”).style.left=“260px”将flash对象移到右列旁边但它不起作用。我无法理解这个问题 提前谢谢 <div id="flashobj">You need Flash player 10+ and JavaScript enabled to view this video.</div> <div id="banner
document.getElementById(“flashobj”).style.left=“260px”将flash对象移到右列旁边代码>但它不起作用。我无法理解这个问题
提前谢谢
<div id="flashobj">You need Flash player 10+ and JavaScript enabled to view this video.</div>
<div id="banner">
</div>
<form id="combination" action="index.php" method="get" name="combination" target="_self">
<div class="FixedHeightContainer">
<div class="TContent">
<input type="hidden" name="view" value="" />
</div>
</div>
</form>
<script type="text/javascript">
navigator.sayswho= (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
return M;
})();
var browser=navigator.sayswho;
if(browser[0] == 'MSIE')
{
document.getElementById("flashobj").style.left = "260px";
}
swfobject.addLoadEvent( ytplayer_render_player );
function ytplayer_render_player( )
{
var so = swfobject.embedSWF
(
'http://www.youtube.com/apiplayer?video_id=_vx1OVLX5Rc&enablejsapi=1&autoplay=1&loop=1&version=3&rel=0&fs=1&playerapiid=ytplayer',
'flashobj',
600,
400,
'10',
null,
null,
{
allowScriptAccess: 'always',
allowFullScreen: 'true'
},
{
id: 'flashobj'
}
);
}
您需要启用Flash player 10+和JavaScript才能观看此视频。
navigator.sayswho=(函数(){
var N=navigator.appName,ua=navigator.userAgent,tem;
var M=ua.match(/(opera | chrome | safari | firefox | msie)\/?\s*(\.?\d+(\.\d+)/i);
如果(M&(tem=ua.match(/version\/([\.\d]+)/i))!=null)M[2]=tem[1];
M=M?[M[1],M[2]]:[N,navigator.appVersion'-?';
返回M;
})();
var browser=navigator.sayswho;
如果(浏览器[0]=“MSIE”)
{
document.getElementById(“flashobj”).style.left=“260px”;
}
swfobject.addLoadEvent(ytplayer\u render\u player);
函数ytplayer\u render\u player()
{
var so=swfobject.embeddeswf
(
'http://www.youtube.com/apiplayer?video_id=_vx1OVLX5Rc&enablejsapi=1&autoplay=1&loop=1&version=3&rel=0&fs=1&playerapiid=ytplayer',
“flashobj”,
600,
400,
'10',
无效的
无效的
{
allowScriptAccess:“始终”,
allowFullScreen:'真'
},
{
id:“flashobj”
}
);
}
确保在您试图定位的元素上设置了相对位置(或绝对位置,或固定位置)。#flashobj{left:260px;position:relative;z-index:1;}@falguni如何使用css检测浏览器类型并设置if条件?