rozwijana i zwijana tabelka

0

Jak zrobić, żeby zamiast tekstu był obrazek wyświetlany tu gdzie jest up.png i down.png, bo jest jakiś błąd pokazuje tekst zamiast obrazka.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
	<meta http-equiv="Content-type" content="application/xhtml+xml; charset=utf-8" />
	<title>Częściowe rozwijanie i zwijanie tabeli w jQuery</title>
 
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
 
	<link rel="stylesheet" href="tabela.css" type="text/css" />
 
	<script type="text/javascript">
		
		$(function() {
			var ile = '3'; //ile wierszy pokazać
			$('#zwijana tbody tr:nth-child('+ile+')').nextAll().hide();
			
			$('.przycisk').toggle(function(){
				$('#zwijana tbody tr:nth-child('+ile+')').nextAll().show();
				$(this).text("up.png");  
				return false;
			},
			function(){	
				$('#zwijana tbody tr:nth-child('+ile+')').nextAll().hide();
				$(this).text("down.png");
				return false;
			});
		});
		
	</script>
 
 
	<!--[if lt IE 8]>
	<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
	<![endif]-->
</head>
<body>

	<table id="zwijana" cellspacing="0" >
		<thead>
			<tr>
				<th>kolumna 1</th><th>kolumna 2</th><th>kolumna 3</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>Wiersz 1</td><td>lorem</td><td>+</td>
			</tr>
			<tr>
				<td>Wiersz 2</td><td>ipsum</td><td>+</td>
			</tr>
			<tr>
				<td>Wiersz 3</td><td>dolor</td><td>-</td>
			</tr>
			<tr>
				<td>Wiersz 4</td><td>sit</td><td>+</td>
			</tr>
			<tr>
				<td>Wiersz 5</td><td>amet</td><td>-</td>
			</tr>
			<tr>
				<td>Wiersz 6</td><td>consectetur</td><td>-</td>
			</tr>
			<tr>
				<td>Wiersz 7</td><td>adipisicing</td><td>+</td>
			</tr>
			<tr>
				<td>Wiersz 8</td><td>elit</td><td>+</td>
			</tr>
			<tr>
				<td>Wiersz 9</td><td>sed</td><td>-</td>
			</tr>
		</tbody>
	</table>

	<p><a href="#" class="przycisk"><img src="down.png" /></a></p>
	
</body>
</html>
0

To nie przez to:

$(this).text("up.png");

?

Może powinno być $(this).find('img').attr('src',"up.png");

I analogicznie dla down?

0

dzięki, działa :D

1 użytkowników online, w tym zalogowanych: 0, gości: 1