比如我點擊后樣式改變,如何將改變的樣式存到localstorage中去,并存下點擊的次數?<!doctype html><html> <head> <meta charset="UTF-8" /> <title>Document</title> <script src="http://libs.baidu.com/jquery/1.7.0/jquery.min.js" type="text/javascript" charset="utf-8"></script> <style> .box { width: 100px; height: 100px; background: #333; color: #fff; margin: 15px auto; } </style> </head> <body> <div class="box">1</div> <div class="box">2</div> <div class="box">3</div> <div class="box">4</div> <div class="box">5</div> <script type="text/javascript"> $(".box").click(function() { $(this).css('background', 'red'); }); </script> </body></html>
localstorage如何存儲樣式
www說
2018-10-15 10:18:07