您好在网上找了一段时间,非常感谢您的帮助。我需要知道在页面重新加载后,哪些涉及 cookie 的脚本可以将以下代码中的切换 div 保持在“CLICKED”状态。感谢所有人和任何人的帮助,并提前表示感谢。
<!DOCTYPE html>
<html>
<head>
<style>
p.one { position:relative; width:400px; height:90px; }
div.two { position:relative; width:400px; height:65px;
font-size:36px; text-align:center;
color:yellow; background:red;
padding-top:25px;
top:0; left:0; display:none; }
span.three { display:none; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p class="one">
Let it be known that the party of the first part
and the party of the second part are henceforth
and hereto directed to assess the allegations
for factual correctness...
<input type="button" id="toggle_button" value="TEST" />
</div>
<div id="two" class="two"><span id=''three' class="three">Click here to continue...</span></div>
</p>
<script>
$('#toggle_button').click(function () {
$("#two").fadeIn(3000, function () {
$("#three").fadeIn(100);
});
return false;
});
</script>
</body>
</html>
我怎样才能得到像下面这样的东西来处理我的代码?
<script type="text/javascript">
$(function() {
var cookie = document.cookie,
state = cookie.substr(cookie.search('buttonCollapsed=')+16,1),
elem = $('div.collapsable');
if (state == 1) {
elem.hide();
}
elem.slideToogle(function() {
if ( elem.is(':visible') ) {
document.cookie = "toggle_button=0";
} else {
document.cookie = "toggle_button=1";
}
});
});
</script>