mam to zrobione inaczej ale mam pewien problem zaraz wyślę co mam zrobione i jak i z czym mam problem
Otóż zrobiłem tak:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2"> <meta name="Description" content=" [wstaw tu opis strony] "> <meta name="Keywords" content=" [wstaw tu slowa kluczowe] "> <meta name="Author" content=" [dane autora] "> <meta name="Generator" content="kED2">
<link rel="stylesheet" href="style.css " type="text/css"> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(document).ready(function() {
// red
$("#css-red").click(function() {
$("link[rel=stylesheet]").attr({href : "red.css"});
});
// blue
$("#css-blue").click(function() {
$("link[rel=stylesheet]").attr({href : "blue.css"});
});
// green
$("#css-green").click(function() {
$("link[rel=stylesheet]").attr({href : "green.css"});
});
});
<li><a id="css-red" href="#red">Red
</a></li> <li><a id="css-blue" href="#blue">Blue
</a></li> <li><a id="css-green" href="#green">Green
</a></li> <a href="1.html">wejdź
</a>
i do tego domyślny css:
body
{
margin-left : auto;
margin-right : auto;
padding : 0;
background-color: black;
height : auto;
font-family : verdana;
font-size : 12px;
color : white;
}
oraz css'y zastępcze oczywiście każdy w innym pliku:
body
{
margin-left : auto;
margin-right : auto;
padding : 0;
background-color: red;
height : auto;
font-family : verdana;
font-size : 12px;
color : white;
}
body
{
margin-left : auto;
margin-right : auto;
padding : 0;
background-color: blue;
height : auto;
font-family : verdana;
font-size : 12px;
color : white;
}
body
{
margin-left : auto;
margin-right : auto;
padding : 0;
background-color: green;
height : auto;
font-family : verdana;
font-size : 12px;
color : white;
}
oraz plik z linku:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2"> <meta name="Description" content=" [wstaw tu opis strony] "> <meta name="Keywords" content=" [wstaw tu slowa kluczowe] "> <meta name="Author" content=" [dane autora] "> <meta name="Generator" content="kED2">
<link rel="stylesheet" href="style.css " type="text/css"> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(document).ready(function() {
// red
$("#css-red").click(function() {
$("link[rel=stylesheet]").attr({href : "red.css"});
});
// blue
$("#css-blue").click(function() {
$("link[rel=stylesheet]").attr({href : "blue.css"});
});
// green
$("#css-green").click(function() {
$("link[rel=stylesheet]").attr({href : "green.css"});
});
});
<li><a id="css-red" href="#red">Red
</a></li> <li><a id="css-blue" href="#blue">Blue
</a></li> <li><a id="css-green" href="#green">Green
</a></li> <a href="index.html">wróć
</a>
no i wszystko ładnie pięknie działa tło się przełącza, jadnak problem z tym że po przejściu na podstronę ustawia się tło z domyślnego pliku css czyli czarne. Słyszałem że da się jakoś zrobić żeby ustawienie było zapamiętywane. ale nie mam pojęcia jak to zrobić