0

hi.

I have a list of names of flash files. On clicking anyone of them, flash file(.swf) whose path is know should play on the same webpage, on the right side of the list
I know the code to play swf file. But here the file name has to be passed and what i need is to pass the file name at runtime depending on the link clicked.
Please help

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by McLaren
0

You can use jquery .html method.

<!DOCTYPE html>
<html>
<head>
  <style>

  .red { color:red; }
  </style>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
  <span>Hello</span>
  <div></div>
  <div></div>
  <div></div>
<script>
	$("span").click(function(){
		
		$("div").html("<span class='red'>Hello <b>Again</b></span>");
	});
</script>

</body>
</html>

Click on the text Hello and html code will be added. Just change html code to code which is needed to embed swf file and it should work.

If you want on link click - just do

$("a").click

Then you may want to click a specific link. So you could and some id to your link and then select by id:

$("a#yourLinkId").click

0
$.post(base_url+"admin_/reklama/get_filename/"+id, function(filename){
  var ext = filename.split('.').pop().toLowerCase();	//gaunam failo galune


							
if(ext == 'swf')
{
									
								
									
//alert("Data Loaded: " + data);					
									
$('.reklamosRedagavimas').append('<div class = "rek_block" id = rek_block_' + id + '>' 
+ '<span id = "reklama_' + id + '" class = "reklama"><embed class = "reklama" src="' + base_url + 'uploads/reklama/'+filename+'" width="290" height="100"></embed></span> '
+ '<a id = "up_' + id + '" class = "up" href="#"><img src = "' + base_url + 'images/admin/reklama_edit/up.gif" title = "Perkelti aukščiau"</img></a> '
+ '<a id = "delete_' + id + '" class = "delete" href="#"><img src = "' + base_url + 'images/admin/reklama_edit/cross.png" title = "Trinti"</img></a> '
+ '<a id = "down_' + id + '" class = "down" href="#"><img src = "' + base_url + 'images/admin/reklama_edit/down.gif" title = "Nuleisti žemiau"</img></br></a></div>');
$('#down_'+ id).hide();

										
							

								
}
else
{
									
										
$('.reklamosRedagavimas').append('<div class = "rek_block" id = rek_block_' + id + '>'
+ '<span id = "reklama_' + id + '" class = "reklama"><img class = "reklama" src="' + base_url + 'uploads/reklama/'+filename+'" alt="#" /></span> '
+ '<a id = "up_' + id + '" class = "up" href="#"><img src = "' + base_url + 'images/admin/reklama_edit/up.gif" title = "Perkelti aukščiau"</img></a> '
+ '<a id = "delete_' + id + '" class = "delete" href="#"><img src = "' + base_url + 'images/admin/reklama_edit/cross.png" title = "Trinti"</img></a> '
+ '<a id = "down_' + id + '" class = "down" href="#"><img src = "' + base_url + 'images/admin/reklama_edit/down.gif" title = "Nuleisti žemiau"</img></br></a>'
+ '<div class="edit_link">'
+ '<label for="input">Nuoroda:* </label><input type="text" name="link' + id +'" value="http://" maxlength="10000" size="30" class="link" id="link_'+ id +'">'
+ '<div class="errorsSmall" id="error_link_'+ id +  '"></div></div></div>' );									
$('#down_'+ id).hide();
										
										
 }
				//patikrinam, ar tai pirmoji uploadinama reklama, jei taip
				//tai slepiam ir up mygtuka
								
$.post(base_url+"admin_/reklama/count_ads/", function(count_ads){
if(count_ads == 1)
	$('#up_'+ id).hide();
if(count_ads > 1)
		//rodom down mygtuka pries tai einanciai reklamai
$.post(CI.base_url+"admin_/reklama/ad_id/"+(count_ads-1), function(prev_ad_id){
$('#down_'+ prev_ad_id).show();
		});
								
									
});
							
							 
		
})

the code is not very nice, but but might be still usefull. Look at block

if(ext == 'swf')

and you can see

$('.reklamosRedagavimas').append

and as argument for append funtion there is html code. Append is similar to .html, it does not remove existing html code, but appends to it as you probably understand already. .html should replace code.

You must put the $.post function in you link click funtion body. If you have questions then ask.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.