lundi 28 mars 2016

I cant figure out how to make two choices then show what your choice was

Okay this is the whole thing right now. The bold part is giving me trouble. The rest of it works how I want it too but I cannot for the life of me get this. I have googled this so many times Im being advertized java lessons and coding classes.

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Text adventure</h1>
<p>By Caleb Scott Sanders</p>
    <p id="1"></p>
    <p id="2"></p>
    <p id="3"></p>
        <script>
            document.getElementById("demo").innnerHTML = confirm("Sup");
        </script>

        <script>
            document.getElementById("1").innerHTML = "you wake up in a dark and dusty room, its cramped and only two potential exits. The door or the window.";
            document.getElementById("2").innerHTML = "1: check door 2: check window";
        </script>
        **<script>//From here
            document.getElementById("demo").innerHTML = 
                choice = prompt();

                if(choice = a){

                    document.getById("3").innerHTML = "The door has a large iron lock with equaly large bars. This seams more like a cell gate than a door...";
                }else if(choice = b){

                    document.getById("3").innerHTML = "The window is open but looks too small to crawl through. No way out from here.";
                };

        </script>
    <p id="3"></p>// to here is the problem

</body>

</html>

Please tell me what Ive done wrong because I cannot.

Aucun commentaire:

Enregistrer un commentaire