Jeśli wykreślę bloki if to wartość url przekazuje prawidłową wartość. Pytanie czemu IF-y nie działają ? Jeśli skrypt nie znajdzie w adresie URL żadnego ciągu to domyślnie przypisuje zmiennej link wartość
images/products.jpg tymczasem nic takiego nie ma miejsca i skrypt w ogóle nic nie wyświetla.
<script language="javscript" type="text/javascript">
<!-- ukrywamy kod przed nieznającymi nas przeglądarkami
var dir = location
.href
.substring
(0,location
.href
.lastIndexOf
("/")+1
); var url
= location
.href
.substring
(dir.length
,location
.href
.length
+1
); var gdzie;
gdzie = url.indexOf("filtry");
if (gdzie
!= -1
) {link = "images/products.jpg"} gdzie = url.indexOf("alkomaty");
if (gdzie
!= -1
) {link = "images/alkomaty.jpg"} gdzie = url.indexOf("zapinki");
if (gdzie
!= -1
) {link = "images/zapinki.jpg"} else {link = "images/products.jpg"}
// koniec skryptu - koniec ukrywania -->
</script>