Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
</head>
<body onload="loadSett()">
    <form id="settingsForm" name="settingsForm">
        <select name="Sound" id="Sound">
            <option value="0">Off</option>
            <option value="1">On</option>
        </select>
        <select name="Vibration" id="Vibration">
            <option value="0">Off</option>
            <option value="1">On</option>
        </select>
    </form>
    <div id="output"></div>
    <script type="text/javascript">
        var getSound;
        var getVibra;
        function loadSett() {
            var form = $("#settingsForm");
            getSound = localStorage.getItem("sound");
            getVibra = localStorage.getItem("vibra");
            alert("getSound: "+getSound);
            alert("getVibra: "+getVibra);
            if(getSound != undefined && getVibra != undefined) {
                if(getSound == "1"){
                    document.getElementById('Sound').options[1].selected = true;
                }
                if(getVibra == "1"){
                    document.getElementById('Vibration').options[1].selected = true;
                }
            } else { 
                alert("Empty. Setting them now."); 
                localStorage.setItem("sound",1);
                localStorage.setItem("vibra",1);
            }
        }
    </script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers