P
P
partyzanx2017-07-28 14:58:50
JavaScript
partyzanx, 2017-07-28 14:58:50

How to remember in cookies?

Help to modify the code so that Java remembers cookies. Thanks

<script>
show.visible = '2';
show.hidden = '3';
 function show(){
 	show.hidden = show.visible;
 	show.visible = (show.visible === '2')?'3':'2';
  document.getElementById(show.visible).style.display = 'block';
  document.getElementById(show.hidden).style.display = 'none';
}
 </script>

<a href="#" onClick="show();">показать/скрыть</a>
 <div id="2" style="display:block">
 Скрытый текст1
 </div>

 <div id="3" style="display:none">
 Скрытый текст2
 </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2017-07-28
@RidgeA

https://learn.javascript.ru/cookies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question