Jump to content

simple jQuery code does not work in IE6 and IE7


Recommended Posts

Hello everybody,I have a problem with a simple jQuery code and I can't figure out why it couldn't work on IE6 or IE7. I must say I don't have access to either one of this browsers, the problem has been reported to me by my client. Javascript is activated in the browser (I've already asked that).Does anyone have an idea as to where could the problem lie? It works fine on Safari, FF, Opera and IE9 (IE8 not tested)Thank you in advance!Here is the code (it should change the src of the img.big to the src of one of the img.small on the click event):HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link href="/resources/styles/style.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript" src="/resources/styles/style.js"></script><style type="text/css">#menu li a.menu03 {	background-color:#FFF4C5;}</style></head><body><div id="header"><img src="resources/styles/header.gif" /></div><div id="page"><ul id="menu"><li><a class="menu01" href="index.php">Chi Siamo</a></li><li><a class="menu02" href="storia.php">Storia</a></li><li><a class="menu03" href="opere_realizzate.php">Opere realizzate</a></li><li><a class="menu04" href="opere_in_corso.php">Opere in corso</a></li><li><a class="menu05" href="il_nostro_team.php">Il nostro team</a></li><li><a class="menu06" href="contatti.php">Contatti</a></li></ul><div id="content"><img class="header" src="resources/immagini/foto_opere_realizzate.jpg" /><img src="resources/immagini/intestazione_opere_realizzate.jpg" /><div class="left"><div class="opera_big"><p class="title">TITLE</p><p>Località: Comano</p><p>Anno: 2005</p><br /><p>Casa d'abitazione plurifamiliare</p><br /><p>Casa d'abitazione plurifamiliare edificata a Comano.</p><img class="small" src="opere/foto_piccole/Comano (1).jpg" /><img class="small" src="opere/foto_piccole/Comano (2).jpg" /><img class="small" src="opere/foto_piccole/Comano (3).jpg" /><img class="small" src="opere/foto_piccole/Comano.jpg" /><img class="big" id="foto" src="opere/foto_grandi/Comano (1).jpg" /></div></div><img src="resources/immagini/slogan_opere_realizzate.gif" />		</div></div><div id="footer"><p class="left">footer text</p><p class="right"> </p></div></body></html>

jQuery (content of file style.js):

$(document).ready(function() {	$("#content div.opera_big img.small").click(function() {		foto = $(this).attr("src");		$("#foto").attr("src",foto.replace("piccole", "grandi"));	});});

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...