dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: I can't figure out what's wrong with this code

  1. #1
    Join Date
    Feb 2007
    Posts
    9

    Question I can't figure out what's wrong with this code

    I made a code for a little prize drawing on my web site, but The "Get a QP" button isn't working. If anyone can help me with this code, I'd really appreciate it.


    <HTML>
    <HEAD>

    <TITLE>Get a Code</TITLE>
    //--!This is to get the code
    <SCRIPT language="JavaScript">
    <!--
    function get_random()
    {
    var ranNum= Math.floor(Math.random()*100);
    return ranNum;
    }

    function getaQP()
    {
    var getQP=get_random();

    var quote=new Array(100)
    quote[0]='9, 26, 18, 56, 23';
    quote[1]='36, 41, 8, 16, 20';
    quote[2]='21, 11, 62, 28, 56';
    quote[3]='8, 53, 36, 55, 56';
    quote[4]='37, 21, 33, 16, 64';
    quote[01]='52, 12, 37, 41, 39';
    quote[11]='13, 29, 60, 52, 19';
    quote[21]='5, 69, 4, 42, 2';
    quote[31]='41, 42, 57, 20, 21';
    quote[41]='67, 28, 36, 61, 35';
    quote[02]='8, 35, 26, 29, 23';
    quote[12]='25, 15, 20, 8, 65';
    quote[22]='9, 12, 10, 32, 28';
    quote[32]='19, 30, 13, 11, 15';
    quote[42]='22, 18, 57, 13, 46';
    quote[03]='24, 52, 17, 10, 29';
    quote[13]='31, 14, 10, 54, 7';
    quote[23]='34, 30, 37, 63, 68';
    quote[33]='15, 15, 63, 38, 53';
    quote[43]='55, 24, 20, 40, 7';
    quote[04]='26, 57, 35, 31, 46';
    quote[14]='2, 33, 22, 32, 37';
    quote[24]='41, 14, 38, 19, 33';
    quote[34]='53, 53, 18, 49, 21';
    quote[44]='50, 32, 54, 27, 61';
    quote[05]='48, 39, 63, 29, 60';
    quote[15]='11, 8, 33, 22, 51';
    quote[25]='49, 23, 20, 45, 18';
    quote[35]='61, 64, 45, 68, 12';
    quote[45]='19, 63, 33, 2, 52';
    quote[06]='9, 26, 16, 15, 1';
    quote[16]='7, 28, 11, 62, 51';
    quote[26]='26, 36, 24, 37, 26';
    quote[36]='69, 7, 69, 52, 60';
    quote[46]='13, 44, 65, 7, 4';
    quote[07]='65, 29, 17, 58, 16';
    quote[17]='29, 67, 29, 37, 36';
    quote[27]='32, 38, 46, 6, 39';
    quote[37]='56, 42, 20, 48, 24';
    quote[47]='23, 19, 16, 24, 2';
    quote[08]='15, 49, 60, 26, 9';
    quote[18]='60, 66, 63, 38, 8';
    quote[28]='20, 58, 59, 54, 3';
    quote[38]='25, 63, 63, 44, 39';
    quote[48]='47, 9, 24, 8, 19';
    quote[09]='47, 58, 66, 43, 14';
    quote[19]='64, 29, 69, 60, 12';
    quote[29]='66, 59, 66, 34, 33';
    quote[39]='36, 38, 24, 46, 19';
    quote[49]='69, 24, 58, 19, 44';
    quote[011]='63, 44, 4, 62, 46';
    quote[111]='21, 27, 64, 40, 63';
    quote[211]='60, 9, 13, 51, 65';
    quote[311]='39, 23, 60, 59, 58';
    quote[411]='6, 51, 55, 9, 54';
    quote[022]='40, 25, 32, 2, 50';
    quote[122]='41, 44, 34, 44, 1';
    quote[222]='26, 64, 37, 10, 2';
    quote[322]='33, 50, 9, 36, 10';
    quote[422]='13, 24, 37, 67, 64';
    quote[033]='35, 4, 68, 20, 58';
    quote[133]='27, 65, 61, 34, 18';
    quote[233]='21, 5, 38, 23, 60';
    quote[333]='44, 16, 19, 56, 39';
    quote[433]='26, 34, 36, 43, 20';
    quote[044]='38, 4, 59, 57, 67';
    quote[144]='38, 46, 39, 46, 13';
    quote[244]='16, 49, 41, 8, 45';
    quote[344]='7, 37, 64, 42, 53';
    quote[444]='48, 14, 51, 33, 3';
    quote[055]='22, 15, 59, 49, 58';
    quote[155]='21, 6, 43, 35, 7';
    quote[255]='30, 44, 64, 6, 63';
    quote[355]='32, 16, 1, 38, 23';
    quote[455]='68, 21, 36, 49, 32';
    quote[066]='56, 64, 69, 33, 4';
    quote[166]='14, 65, 8, 49, 35';
    quote[266]='35, 45, 18, 36, 16';
    quote[366]='17, 11, 63, 50, 62';
    quote[466]='64, 35, 15, 56, 63';
    quote[077]='30, 34, 28, 38, 20';
    quote[177]='37, 20, 42, 55, 59';
    quote[277]='19, 58, 26, 15, 12';
    quote[377]='50, 24, 62, 13, 28';
    quote[477]='1, 49, 12, 14, 4';
    quote[088]='57, 15, 63, 45, 65';
    quote[188]='49, 28, 67, 17, 52';
    quote[288]='24, 10, 11, 11, 58';
    quote[388]='11, 62, 56, 64, 19';
    quote[488]='43, 30, 26, 28, 35';
    quote[099]='26, 11, 61, 3, 22';
    quote[199]='41, 63, 64, 32, 48';
    quote[299]='51, 49, 38, 56, 9';
    quote[399]='36, 56, 7, 13, 54';
    quote[499]='66, 64, 22, 12, 6';
    quote[000]='67, 40, 28, 38, 43';
    quote[100]='4, 22, 50, 60, 46';
    quote[200]='4, 22, 50, 60, 46';
    quote[300]='30, 68, 67, 67, 58';
    quote[400]='3, 61, 12, 24, 3';

    alert(quote[whichQuote]);
    }
    //-->
    </SCRIPT>

    //--! and of course this is the end of the code

    </HEAD>


    //--! Ignore this
    <BODY>
    <H2>This is a random 5 number pick (if you click the button) that may be picked more than once. Write it down and type it into the following textbox.</H2>
    <br>
    <H2>If you would like, you can make up your own 5 number pick in the form 1, 2, 3, 4, 5 (must be in that exact way). Just type it into the box.</H2>
    <br>

    //--!isn't working
    <FORM name="form1">
    <INPUT TYPE="button" value="Get a QP" onClick="getanumber()">
    </FORM>
    //--! rest works

    <FORM METHOD=POST ACTION="mailto:info@greatbuysweb.com" ENCTYPE="text/plain">
    <p>E-mail<INPUT TYPE="text" NAME="E-mail" SIZE=18>
    <p>Number<INPUT TYPE="text" NAME="Number" SIZE=18>
    <BR>
    <INPUT TYPE="submit" VALUE="Submit">
    <INPUT TYPE="reset" VALUE="Clear">


    </FORM>
    </BODY>
    Last edited by imagenius; 02-14-2007 at 02:57 PM.

  2. #2
    Join Date
    Jan 2007
    Location
    .qc.ca
    Posts
    43
    Hi imagenius,

    My first idea would be to have different names for your function getanumber() and the variable getanumber...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles