<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Demo</title>
<link rel="stylesheet" type="text/css" href="" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>#changeStyle img{border:solid 2px transparent;}
.STYLselect {border-color:red!important;}
</style>
</head>
<body>
<script type="text/javascript">
var linkStyles = '<link rel="stylesheet" type="text/css" href="';
function setcookie(a, b, c) {
if (c) {
var d = new Date();
d.setDate(d.getDate() + c);
}
if (a && b) document.cookie = a + '=' + b + (c ? '; expires=' + d.toUTCString() : '');
else return false;
}
function getcookie(a) {
var b = new RegExp(a + '=([^;]){1,}');
var c = b.exec(document.cookie);
if (c) c = c[0].split('=');
else return false;
return c[1] ? c[1] : false;
}
function clearSet(L) {
if (L) {
setcookie("changeStyle", L, 30);
$("link[rel='stylesheet']:first").replaceWith(linkStyles + L + '"/>');
}
};
var Lmem = getcookie("changeStyle");
clearSet(Lmem);
</script>
<div id="changeStyle" style="top:0; left: 3px; position:fixed!important;">
<img src="http://www.10pix.ru/img1/3444/5439522.jpg" alt="1.css"/>
<br>
<img src="http://www.10pix.ru/img1/3492/5439523.jpg" alt="2.css"/>
<br>
</div>
<script type="text/javascript">
var W=false;
function TstWidth() {
var s=100; //
var W2=false;
if($(".some").length){var W2 = $(".some").width();return true;
if(W2!=false&&(W2-W)==0){alert(W)}
}
timerId01=setTimeout(function(){TstWidth()},s);return;}
$("#changeStyle img[alt='" + Lmem + "']").addClass("STYLselect");
$('#changeStyle img[alt]').click(function () {
L = $(this).attr("alt");
$('#changeStyle img[alt]').removeClass("STYLselect");
$(this).addClass("STYLselect");
clearSet(L);
TstWidth()
});
</script>
<br /><br /><br /><br /><br />
<div class="some"></div>
</body>
</html> |