SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    england
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with simple bingo card

    Hi
    Im trying to write a small bingo caller script
    you can see the demo here http://www.easynet4u.com/bingo4.htm

    when they click the button a random number appears then shows the drawn numbers further down the page. What i want to do is have a table with numbers 1-90 so when the number is called say 34 it highlights the box 34 also is it possible to draw the numbers automatacally.
    here is the code.

    Code:
    var gblHash=new Array();	
    function getNewRand()
    {
    	return (Math.floor(Math.random()*90)+1);
    }
    function getRand()
    {
    	var ilm=getNewRand();
    	var i=0;
    	while(gblHash[ilm]==1)
    	{
    		i++;
    		ilm=getNewRand();
    		if(i>=30)
    		{
    			alert("All numbers done!");
    			return;
    		}
    	}
    	gblHash[ilm]=1;
    	document.getElementById('randomNumber').innerHTML=ilm;
    	document.getElementById('drawnNumbers').innerHTML
    		+=(" "+ilm);
    }

    and the html
    HTML Code:
    <div id="randomNumber" style="font-size: 150pt;">-1
    	</div>
    	<input type="button" onClick="getRand();" value="Clicky!">
        	 <td><div id="drawnNumbers">
        	   <table width="230" bgcolor="#9A98C9" class="relatedLinks3">
                 <tr>
                   <td width="9"><div align="center" class="style1">1</div></td>
                   <td width="8"><div align="center" class="style1">2</div></td>
                   <td width="10"><div align="center" class="style1">3</div></td>
                   <td width="10"><div align="center" class="style1">4</div></td>
                   <td width="10"><div align="center" class="style1">5</div></td>
                   <td width="10"><div align="center" class="style1">6</div></td>
                   <td width="144"><div align="center" class="style1">7</div></td>
                   <td width="28"><div align="center" class="style1">8</div></td>
                   <td width="29"><div align="center" class="style1">9</div></td>
                   <td width="33"><div align="center" class="style1">10</div></td>
                   <td width="33"><div align="center" class="style1">11</div></td>
                   <td width="33"><div align="center" class="style1">12</div></td>
                   <td width="16"><div align="center" class="style1">13</div></td>
                   <td width="50"><div align="center" class="style1">14</div></td>
                   <td width="34"><div align="center" class="style1">15</div></td>
                 </tr>
                 <tr>
                   <td><div align="center" class="style1">16</div></td>
                   <td><div align="center" class="style1">17</div></td>
                   <td><div align="center" class="style1">18</div></td>
                   <td><div align="center" class="style1">19</div></td>
                   <td><div align="center" class="style1">20</div></td>
                   <td><div align="center" class="style1">21</div></td>
                   <td><div align="center" class="style1">22</div></td>
                   <td><div align="center" class="style1">23</div></td>
                   <td><div align="center" class="style1">24</div></td>
                   <td><div align="center" class="style1">25</div></td>
                   <td><div align="center" class="style1">26</div></td>
                   <td><div align="center" class="style1">27</div></td>
                   <td><div align="center" class="style1">28</div></td>
                   <td><div align="center" class="style1">29</div></td>
                   <td><div align="center" class="style1">30</div></td>
                 </tr>
                 <tr>
                   <td><div align="center" class="style1">31</div></td>
                   <td><div align="center" class="style1">32</div></td>
                   <td><div align="center" class="style1">33</div></td>
                   <td><div align="center" class="style1">34</div></td>
                   <td><div align="center" class="style1">35</div></td>
                   <td><div align="center" class="style1">36</div></td>
                   <td><div align="center" class="style1">37</div></td>
                   <td><div align="center" class="style1">38</div></td>
                   <td><div align="center" class="style1">39</div></td>
                   <td><div align="center" class="style1">40</div></td>
                   <td><div align="center" class="style1">41</div></td>
                   <td><div align="center" class="style1">42</div></td>
                   <td><div align="center" class="style1">43</div></td>
                   <td><div align="center" class="style1">44</div></td>
                   <td><div align="center" class="style1">45</div></td>
                 </tr>
                 <tr>
                   <td><div align="center" class="style1">46</div></td>
                   <td><div align="center" class="style1">47</div></td>
                   <td><div align="center" class="style1">48</div></td>
                   <td><div align="center" class="style1">49</div></td>
                   <td><div align="center" class="style1">50</div></td>
                   <td><div align="center" class="style1">51</div></td>
                   <td><div align="center" class="style1">52</div></td>
                   <td><div align="center" class="style1">53</div></td>
                   <td><div align="center" class="style1">53</div></td>
                   <td><div align="center" class="style1">55</div></td>
                   <td><div align="center" class="style1">56</div></td>
                   <td><div align="center" class="style1">57</div></td>
                   <td><div align="center" class="style1">58</div></td>
                   <td><div align="center" class="style1">59</div></td>
                   <td><div align="center" class="style1">60</div></td>
                 </tr>
                 <tr>
                   <td><div align="center" class="style1">61</div></td>
                   <td><div align="center" class="style1">62</div></td>
                   <td><div align="center" class="style1">63</div></td>
                   <td><div align="center" class="style1">64</div></td>
                   <td><div align="center" class="style1">65</div></td>
                   <td><div align="center" class="style1">66</div></td>
                   <td><div align="center" class="style1">67</div></td>
                   <td><div align="center" class="style1">68</div></td>
                   <td><div align="center" class="style1">69</div></td>
                   <td><div align="center" class="style1">70</div></td>
                   <td><div align="center" class="style1">71</div></td>
                   <td><div align="center" class="style1">72</div></td>
                   <td><div align="center" class="style1">73</div></td>
                   <td><div align="center" class="style1">74</div></td>
                   <td><div align="center" class="style1">75</div></td>
                 </tr>
                 <tr>
                   <td><div align="center" class="style1">76</div></td>
                   <td><div align="center" class="style1">77</div></td>
                   <td><div align="center" class="style1">78</div></td>
                   <td><div align="center" class="style1">79</div></td>
                   <td><div align="center" class="style1">80</div></td>
                   <td><div align="center" class="style1">81</div></td>
                   <td><div align="center" class="style1">82</div></td>
                   <td><div align="center" class="style1">83</div></td>
                   <td><div align="center" class="style1">84</div></td>
                   <td><div align="center" class="style1">85</div></td>
                   <td><div align="center" class="style1">86</div></td>
                   <td><div align="center" class="style1">87</div></td>
                   <td><div align="center" class="style1">88</div></td>
                   <td><div align="center" class="style1">89</div></td>
                   <td><div align="center" class="style1">90</div></td>
                 </tr>
               </table>

  2. #2
    SitePoint Zealot
    Join Date
    May 2009
    Location
    usa
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

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