0

I'm here with the following code in prototype

var id = "bugtv";

if(navigator.userAgent.indexOf("MSIE")>-1){
   flashObj = $(id+'Obj');
}else{
   flashObj = $(id+'Emb');
}

I would like to jQuery

how I do it

flashObj = $(id+'Obj');
flashObj = $(id+'Emb');

in jquery?

thanks

edit

function MontaBugtvFlash(url) {

var id = "bugtv";
var width = "100%";
var height = "100%";
var wmode = "transparent";

var swfbugtv=[];

swfbugtv.push('<object id="'+id+'Obj" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="'+height+'" width="'+width+'">');
swfbugtv.push('<param name="movie" value="'+url+'">');
swfbugtv.push('<param name="quality" value="high">');
swfbugtv.push('<param name="wmode" value="'+wmode+'">');
swfbugtv.push('<param name="menu" value="false">');
swfbugtv.push('<embed src="'+url+'" id="'+id+'Emb" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="'+wmode+'" menu="false" height="'+height+'" width="'+width+'">');
swfbugtv.push('</object>');

document.write(swfbugtv.join(""));

if(navigator.userAgent.indexOf("MSIE")>-1){
   flashObj = $(id+'Obj');
}else{
   flashObj = $(id+'Emb');
}

};


<div id="flashHolder">
  <script type="text/javascript" language="javascript">MontaBugtvFlash("blubix.swf");</script>
</div>
1
  • please include your HTML Commented Sep 22, 2010 at 17:16

3 Answers 3

3

I think this should do it:

var id = "bugtv";
if ($.browser.msie) {
 flashObj = $("#" + id + "Obj");
} else {
 flashObj = $("#" + id + "Emb");
}

or a shorter version:

var id = "bugtv";
flashObj = $("#" + id + $.browser.msie?"Obj":"Emb"));
Sign up to request clarification or add additional context in comments.

Comments

2

jQuery.browser

var id = "bugtv";

if($.browser.msie){
   flashObj = $('#' + id+'Obj');
}else{
   flashObj = $('#' + id+'Emb');
}

Comments

0

You'll want to go over the jQuery selectors API docs. In order to find an element by ID you need to use a css-like selector, so:

$('#' + id + 'Obj')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.