Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- So, erstmal irgendwo die Checkbox einbauen
- <input type="checkbox" onchange="toggleCookie();" id="radioautoload" /><label>Ich will immer gleich Radio</label>
- und dann noch diese 2 JS-Funktionen dazu
- <script>
- function isRadioCookie() {
- if (document.cookie) {
- var r = document.cookie.search('radio=');
- if (document.cookie.substring(r+6, r+7) == '1') {
- LoadLautFmRadio();
- document.getElementById("radioautoload").checked = true;
- }
- }
- }
- function toggleCookie() {
- if (document.getElementById("radioautoload").checked) {
- // set Cookie, valid for a year and load radio
- var a = new Date();
- a = new Date(a.getTime() + 1000*60*60*24*365);
- document.cookie = 'radio=1; expires='+a.toGMTString()+';';
- LoadLautFmRadio()
- } else {
- document.cookie = 'radio=0;';
- }
- }
- </script>
- und die isRadioCookie() musst du dann noch irgendwo nach dem Laden der Seite aufrufen (body onload oder so)
- (alle Angaben ohne Gewรคhr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement