J'ai un script tout simple qui ne fonctionne pas sous IE7
Bonjour, j'ai un script tout simple en jquery qui fonctionne parfaitement sous Chrome 7 / FireFox 5 / Safari 4, mais pas sous IE7.
C'est un script qui permet de choisir la page d'accueil en version allégée ou complète. Et le choix est enregistré dans les cookies.
Code HTML / JS :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<?php
if(!isset($_COOKIE['home'])){
$version="light";
} else {
$version=$_COOKIE["home"];
}
?>
<!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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content=" " />
<meta name="description" content=" " />
<title>PG</title>
<link rel="Shortcut Icon" type="image/ico" href="images/favicon.ico" />
<link href="css/layout.css" rel="stylesheet" type="text/css" media="screen" />
<script src="scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("a#version, a#version2").click(function()
{
$.ajax(
{
type: "GET",
url: ($(this).attr("href")),
cache:false,
success:function(result)
{
location.reload();
}
});
return false;
});
});
</script>
</head>
<body id="home">
<?php if($version=="light"){?>
<a id="version" href="fonction/save_version.php?v=heavy" onclick="$('#version').hide();">Version complète<img src="layout/agrandir.gif" /></a>
<?php } else{?>
<a id="version2" href="fonction/save_version.php?v=light" onclick="$('#version').hide();" style="display:block;">Version allégée<img src="layout/agrandir.gif" /></a>
<?php } ?>
</body>
</html> |
PHP :
Code:
1 2 3 4 5 6 7 8 9 10
| <?php
if($_GET["v"]=="light"){
setcookie("home", "light", time()+60*60*24*100, "/");
echo "version modifié";
}
if($_GET["v"]=="heavy"){
setcookie("home", "heavy", time()+60*60*24*100, "/");
echo "version modifié";
}
?> |
Pourriez-vous me venir en aide, je ne trouve pas de solution ni de bug IE7 repertorié ?
Merci,