Javascript.RU

Создать новую тему Ответ
 
Опции темы Искать в теме
  #11 (permalink)  
Старый 10.08.2011, 13:36
Аватар для ksa
ksa ksa вне форума
CacheVar
Отправить личное сообщение для ksa Посмотреть профиль Найти все сообщения от ksa
 
Регистрация: 19.08.2010
Сообщений: 14,124

Теоретически может сработать такой вариант...

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* {
	margin: 0;
	padding: 0;
}
img {
	border: 0;
}
.imgStyle {
	height:60px;
}
#data {
	width: 500px;
	word-spacing: 0;
}
</style>
<script type="text/javascript">
function filter(costType) {
var globalCost = costType;
var imgListTD = document.getElementById("image_list");
var images = imgListTD.getElementsByTagName("img");
for (var i = 0; i < images.length; i++) {
var altText = images[i].getAttribute('alt');
if (globalCost != undefined) {
if (altText.indexOf(globalCost) != -1) {
images[i].style.display = 'inline';
totalVisible++;
}
else {
images[i].style.display = 'none';
}
}
}
}
</script>
</head>
<body>
 <table id='data' border="1">
 <tr>
 <td id="image_list" style="text-align:center">
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
	<img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
 </td>
 </tr>
 </table>
 <input type="button" value="costType0" onClick="filter('costType0')"/>
 <input type="button" value="costType1" onClick="filter('costType1')"/>
 <input type="button" value="costType2" onClick="filter('costType2')"/>
 <input type="button" value="costType3" onClick="filter('costType3')"/>
</body>
</html>


Но у меня ИЕ7 не желает такое поддерживать...
Ответить с цитированием
  #12 (permalink)  
Старый 10.08.2011, 13:39
Аватар для ksa
ksa ksa вне форума
CacheVar
Отправить личное сообщение для ksa Посмотреть профиль Найти все сообщения от ksa
 
Регистрация: 19.08.2010
Сообщений: 14,124

Или вот так...

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* {
	margin: 0;
	padding: 0;
}
img {
	border: 0;
}
.imgStyle {
	height:60px;
}
#data {
	width: 500px;
	white-space: pre-line;
}
</style>

<script type="text/javascript">
function filter(costType) {
var globalCost = costType;
var imgListTD = document.getElementById("image_list");
var images = imgListTD.getElementsByTagName("img");

for (var i = 0; i < images.length; i++) {

var altText = images[i].getAttribute('alt');
if (globalCost != undefined) {
if (altText.indexOf(globalCost) != -1) {
images[i].style.display = 'inline';

totalVisible++;
}
else {
images[i].style.display = 'none';
}
}
}
}
</script>
</head>
<body>
 <table id='data' border="1">
 <tr>
 <td id="image_list" style="text-align:center">
 <img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType3 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType2 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType1 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" /><img class="imgStyle "alt="costType0 cigType0" src="item1_1.jpg" />
 </td>
 </tr>
 </table>
 <input type="button" value="costType0" onClick="filter('costType0')"/>
 <input type="button" value="costType1" onClick="filter('costType1')"/>
 <input type="button" value="costType2" onClick="filter('costType2')"/>
 <input type="button" value="costType3" onClick="filter('costType3')"/>
</body>
</html>
Ответить с цитированием
  #13 (permalink)  
Старый 10.08.2011, 15:27
Новичок на форуме
Отправить личное сообщение для aleha Посмотреть профиль Найти все сообщения от aleha
 
Регистрация: 25.03.2011
Сообщений: 8

Класс, я их выстроил в одну большую строку. И на выходе получил одну большую строку, которую не ограничил даже стиль таблицы.
На вскидку приписал туже ширину <td> в котором лежат все картинки и о чудо, они стали переноситься на новую строку и теперь там нет дырок.
Наверно, то из-за чего это всё произошло останется в тайне.
Ответить с цитированием
  #14 (permalink)  
Старый 10.08.2011, 15:32
Аватар для ksa
ksa ksa вне форума
CacheVar
Отправить личное сообщение для ksa Посмотреть профиль Найти все сообщения от ksa
 
Регистрация: 19.08.2010
Сообщений: 14,124

Сообщение от aleha
о чудо, они стали переноситься на новую строку и теперь там нет дырок
Вот что делает крест животворящий! (с)
Ответить с цитированием
Ответ



Опции темы Искать в теме
Искать в теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
window.resizeTo(w,h) в ie8 задёт не те размеры. mister_maxim Internet Explorer 1 29.07.2011 22:51
Как отключить режим совместимости в IE8? kidar2 Internet Explorer 2 25.06.2011 16:45
<= IE8 memory leak, IE9 - fine AbNormy Internet Explorer 1 20.05.2011 19:47
Глюк с background-position-y в ie8 DeMETAL Internet Explorer 3 14.01.2011 17:58
Как обработать изменение масштаба окна в IE8 ? v_k Events/DOM/Window 1 09.08.2010 13:35