Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    7
    Thanked 0 Times in 0 Posts

    help with reseting something

    Okay i have this code that will shuffle some items in an array then after 10 seconds it will hide them. But the problem is after I hide them I can't figure out how to make it so they will be able to be shuffled again and used again. How do I do that? Here's my code


    Code:
    <script type="text/javascript">
    function myFunction()
    {
    var myarray=["red","blue", "yellow", "orange"]
    myarray.sort(function() {return 0.5 - Math.random()})
    var x=document.getElementById("demo");
    x.innerHTML=myarray;
    }
    </script>
    <script type="text/javascript">
    {
    var t=setTimeout("alertMsg()",10000);
    }
    function alertMsg()
    {
     document.getElementById("demo").style.display="none";
    }
    </script>
    
    
    
    
    <button onclick="myFunction()">Twister Drill</button>
    
    <font size="5">
    <p id="demo"></p>
    </font>
    <script type="text/javascript">
    function reset();
    {
    document.getElementById("demo").style.display="block";
    }
    </script>
    <input type="button" onclick="reset()" value="next round">

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,762
    Thanks
    23
    Thanked 548 Times in 547 Posts
    Not too sure what you want. Look at this
    Code:
    <script type="text/javascript">
    var t=setTimeout("reset()",10000);
    
    function myFunction()
    {
    var myarray=["red","blue", "yellow", "orange"]
    myarray.sort(function() {return 0.5 - Math.random()})
    document.getElementById("demo").innerHTML=myarray;
    }
    
    function reset()
    {
    	document.getElementById("demo").innerHTML="";
    }
    </script>
    
    
    
    
    <button onclick="myFunction()">Twister Drill</button>
    
    <font size="5">
    <p id="demo">Some nonsense words</p>
    </font>
    
    <input type="button" onclick="reset()" value="next round">


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •