Help me with this java please

Can any one tell me how to correct this piece of script...its for an online black jack game...there are errors in the script...but i can not see them...can anyone correct these eroors and tell me where i went wrong
<html>
<CENTER></CENTER>
<P>
<HEAD>
<TITLE>BlackJack</TITLE>
<BODY BGCOLOR="#FFFFFF">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from non-JavaScript browsers
function random(maxValue)
day = new Date();
hour = day.getHours();
min = day.getMinutes();
sec = day.getSeconds();
return (((hour + 1) * (min + 1) * sec) % maxValue) + 1;
function pickSuit()
suit = random(4);
if(suit == 1)
return "Spades";
if(suit == 2)
return "Clubs";
if(suit == 3)
return "Diamonds";
return "Hearts"
function cardname(card)
if(card == 1)
return "Ace";
if(card == 11)
return "Jack";
if(card == 12)
return "Queen";
if(card == 13)
return "King";
return "" + card;
function cardValue(card);
if(card == 1)
return 11;
if(card = 10)
return 10;
return card;
function PickACard(strWho)
card = random(13);
suit = pickSuit();
alert(strWho + " picked the " + cardName(card) + " of " + suit);
return cardValue(card);
function NewHand(form)
form.dealer.value = 0;
form.you.value = 0;
form.dealer.value = eval(form.dealer.value) + PickaCard("Dealer");
form.you.value = eval(form.you.value) + PickACard("You");
function Dealer(form)
while(form.dealer.value > 17)
form.dealer.value = eval(form.dealer.value) + PickACard("Dealer");
function User(form)
form.you.value = eval(form.yo.value) + PickACard("You");
if(form.you.value > 21)
alert("You busted!");
function LookAtHands(form)
if(form.dealer.value > 21)
alert("House busts! You win!");
else if(form.you.value > form.dealer.value)
alert("You win!");
else
if(form.dealer.value == form.you.value)
alert("Push!");
else
alert("House wins!");
//-->
</SCRIPT>
<CENTER><H2>BlackJack</H2></CENTER>
<CENTER>To start a hand, click the <i>New Hand</i> button.</CENTER>
<HR>
<CENTER>
<FORM>
<TABLE BORDER=3>
<TR>
<TD>Dealer has</TD>
<TD><INPUT TYPE=TEXT NAME=dealer></TD>
</TR>
<TR>
<TD>You have</TD>
<TD><INPUT TYPE=TEXT NAME=you></TD>
</TR>
</TABLE>
<P>
<CENTER>
<INPUT TYPE=BUTTON VALUE="Hit Me" onClick=User(this.form)>
<INPUT TYPE=BUTTON VALUE="Stand" onClick="Dealer(this.form);LookAtHands(this.form);">
<INPUT TYPE=BUTTON VALUE="New Hand" onClick=NewHand(this.form)>
</CENTER>
</FORM>
</body></html>

This is JavaScript, not Java. They are not even closely related. Post this question some place else.

Similar Messages

  • TS1424 I get "We could not complete your iTunes Store request. An unknown error occurred (4002)  Can any person help me with this on, please?

    I get "We could not complete your iTunes Store request. An unknown error occurred (4002)  Can any person help me with this on, please?

    Turning off iTunes Match and Genius and then turning them back on appears to have worked for some people e.g.
    https://discussions.apple.com/message/22059685#22059685
    https://discussions.apple.com/message/18427550#18427550

  • Hey guy can you please help me with this issue PLEASE!

    Hey Apple can you please help me with this issue, i have a iPhone 3gs and when i put my sim card into the iPhone it makes iphone 3gs shut down suddenly how do i fix that?
    iPhone version: 6.0.1
    service provider: Vodafone nz

    You could restarting your phone that sometimes fixes issues
    Hold down the Sleep/Wake button and the home button together until the apple logo appears (ignore the ON/OFF slider) then let both buttons go and wait for phone to restart (no data will be lost).

  • Help needed with this tutorial please

    Hello in this InsertUpdateDelete tutorial at:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
    or
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    and in this paragraph:
    Changing the Column Components
    and this statement
    In the Visual Designer, select the top Drop Down List component in the Table.
    "It's pretty confusing because there isn't a Drop Down List component in the Table as far as i can tell. There is a Drop Down List on the canvas up above this data table, but that has already been bound in a previous process, here is that previous proces:"
    Configuring the Drop Down List
    Select the Drop Down List in the Visual Designer and, in the Properties window, change its General > id property to personDD.
    Right-click the personDD Drop Down List in the Visual Designer and choose Bind to Data from the pop-up menu. The Bind to Data dialog box appears.........
    Can anyone tell me where i can get help with this tutorial or where i can download the finished program so i can sync up with what is actually being referenced in the questional statement that i mentioned above please?
    Thanks very much!
    BobK

    In Step 5 of "Changing the Column Components" you change the Trip Type column to a drop-down list.
    5. Select TRIP.TRIPTYPEID from the Selected list and make the following changes:
    * Change the Header text field from TRIPTYPEID to Trip Type.
    * Using the drop-down list, change the Component Type from Static Text to Drop Down List.
    6. Click OK to enforce your changes and dismiss the window. If the table columns are too wide after performing the above steps, you can resize them by selecting the first component in each column and dragging its selection handles.
    7. In the Visual Designer, select the top Drop Down List component in the Table. Right-click and choose Bind to Data from the pop-up menu. The Bind to Data dialog box opens.

  • Help me with this problem please

    ive had my ipod for a couple months now and i had to update the software but when i do it, the updater comes up and says either cant mount ipod and ive done everything possible to fix it but still doesnt work.. can anyone help me out with this so i could listen to my music again

  • Help me with this error please. 0xe800065

    This error drives me nuts. When i plug in my iphone 4s the error 0xe800065 pops up in the itunes saying it cant connect. My iphone is also in a bad shape because it just updated from ios 6.0.1 to 6.1 without me knowing it. My iphone needs to activate with wifi connection but then it fails every time or connect with itunes but....  Can somebody please help me?

    There are troubleshooting steps for 0xE errors here: http://support.apple.com/kb/TS3221.

  • Help me with this code please

    Hello,
    This is the first program that I have attempted to write alone....and I am stuck. I am trying to acquire data from a scope. I want the vi to only load the scope setup the first time the code is executed. Once the setup has been loaded I just want the vi to reinitialize the scope in order to acquire more data. I have tried first call, case structures, ...everything I can think of, but when I continuously run the vi, it still loops and reloads the setup each time. I have attached a picture of the vi code and outlined the area of code in question. The outlined case structure is programmed to initialize the scope to open communications, then clear any existing data, then recall a specific scope setup on true. On false, I only want this setting of code to initialize communications with the scope again without recalling the setup. Can a professional please explain how I am supposed to accomplish this. Thank you
    Solved!
    Go to Solution.
    Attachments:
    Code.jpg ‏69 KB

    If you use CONTINUOUSLY RUN to keep something running, you are in effect pushing the RUN button every time it stops, so the FIRST RUN function will return TRUE every time.
    There are ways to do exactly what you ask, but you're better off looking at the heart of your issue:
    You need a loop.
    Put a WHILE loop around the part you want to do repeatedly.
    Create a STOP button to stop the loop.
    Do your once-only INIT stuff outside the loop, and make sure the INIT part passes something into the WHILE loop 
    (to make sure the loop doesn't start until after INIT).
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Help me with this menu please!!!

    Hi
    import java.awt.*;
    import javax.swing.*;
    public class MyMenue extends CloseWindow
    public MyMenue(String title)
    super(title);
    //Menu Items
    JMenuBar jmbar = new JMenuBar();
    JMenu jmenue_1 = new JMenu("JMenue_1");
    JMenu jmenue_2 = new JMenu("JMenue_2");
    jmenue_2.add(new JMenuItem("MenuItem_1.1"));
    jmenue_2.add(new JMenuItem("MenuItem_1.2"));
    jmenue_2.add(new JMenuItem("MenuItem_1.3"));
    //Creating Sumbemnus and their items
    JMenuItem mitem2 = jmenue_2;
    jmenue_1.add(mitem2);
    //Adding one menue to the Menu Bar class
    jmbar.add(jmenue_1);
    // Adding secend submenu on the buttom of menu items
    jmenue_1.add(new JMenuItem("MenuItem_1"));
    jmenue_1.add(new JMenuItem("MenuItem_2"));
    jmenue_1.add(new JMenuItem("MenuItem_3"));
    getContentPane().add(jmbar,BorderLayout.SOUTH);
    //jpopup.add(jmenue_1);
    setSize(300,200);
    setVisible(true);
    public MyMenue()
    this("This is my 1st menue");
    public static void main(String[] args) throws InterruptedException //NullPointerException
    MyMenue myM = new MyMenue("This is my 1st menue");
    Does anybody know how to change the background color and how do you do to use hyperlinks in menuitems and who about user interactivity for ex. when s/he click on the menu it should open new web page in the browsers. Dose anybody know the codes or have EXACLY on this topic good resources on the web where i can lear it. I have to books about Java 2 but they don't have exaples so i am appriciate for exaples.
    Second thing, is everything in my codes looks alright, ?
    Before i threw exception in the main method the program was freezing up when i click couple time the menues and the put mouse over the menu 1 containing the sub-menus -> Why was that, what caused it, and how to hadle that, (did i handled corectly? in the applet above?)
    Sorry for that much text to read!
    Thanks in advance
    Any hint from you I apprieciate

    Hi.
    I got some possible answer for U.
    For opening a page in the default browser, U can use this type of program (more informations are available at "question of the week number15"):
    import java.io.*;
    class Launch{
         public Launch()
              try{
              /* ok for windows NT */
              Runtime.getRuntime().exec("cmd /c start www.yahoo.com");
              /* normally ok for windows95 */
         //Runtime.getRuntime().exec("start www.yahoo.com");
         } catch (IOException exception) {
              System.out.println ( exception.getMessage());
    To change the background color (in red in this example), use :
    this.getContentPane().setBackground(Color.red);
    good luck

  • Help me with this class please

    Ok, so I have written the following class but I have 2 problems:
    1 - Why does my error checking not work. By this I mean even if I enter a month over 12 or a day of the month over 31 it still prints it out instead of saying "Invalid"???
    2 - How, in the toString can I convert the date from the format 12/3/2002 say it says 12 March 2002??
    Thanks in advance for any help
    public class Date {
    // Date Class Constants
    private static final int MAX_DAY = 31;
    private static final int MIN_DAY = 1;
    private static final int MAX_MONTH = 12;
    private static final int MIN_MONTH = 1;
    private static final int MAX_YEAR = 2100;
    private static final int MIN_YEAR = 2000;
    // Date instance variables
    private int day;
    private int month;
    private int year;
    private String AllDate;
    // Date Class Methods
    public Date(String s)
    AllDate = s;
    public int getDay()
    Integer iDay = new Integer(AllDate.substring(0,2));
    day = iDay.intValue();
    if (day > MAX_DAY && day < MIN_DAY)
    System.err.println("Invalid day");
    System.exit(1);
    return day;
    public int getMonth()
    Integer iMonth = new Integer(AllDate.substring(3,5));
    month = iMonth.intValue();
    if (month > MAX_MONTH && month < MIN_MONTH)
    System.err.println("Invalid month");
    System.exit(1);
    return month;
    public int getYear()
    Integer iYear = new Integer(AllDate.substring(6));
    year = iYear.intValue();
    if (year > MAX_YEAR && year < MIN_YEAR)
    System.err.println("Invalid year");
    System.exit(1);
    return year;
    // Instance Methods - Mutators
    public boolean isDay(int d)
    boolean validDay = false;
    if (day == d)
    validDay = true;
    return validDay;
    public boolean isMonth(int m)
    boolean validMonth = false;
    if (month == m)
    validMonth = true;
    return validMonth;
    public boolean isYear(int y)
    boolean validYear =false;
    if (year == y)
    validYear = true;
    return validYear;
    // Other Date Methods
    * return a string representing the Date in English
    public String toString()
    return "getDay()" + "getMonth()" + getYear();
    // end of class Date
    // Date test harness
    public static void main(String[] args) {
    EasyReader keyboard = new EasyReader();
    EasyWriter screen = new EasyWriter();
    // declare Date variables
    String newDate = keyboard.readString("Enter Date: ");
    System.out.println(newDate.toString());

    Because:
    1. You never create an instance of your Date class
    2. You never call any of your validation methods
    3. Even if you fixed 1. and 2. your code would not flag 4/31/2001 as an invalid date (different months have different maximum day values)
    Here's what you should do.
    1. Change all your getxxx method names to setxxx and call them from your constructor
    2. Add getxxx methods that simply return the current values
    3. In your driver (main()) code, create a new instance of Date, passing it the string you read in
    4. Don't forget leap years!
    Doug

  • Help me with this java problem plz

    this is my interface:
    public interface Lockable
        public void setKey (int key);
        public int lock (int key);
        public int unlock (int key);
        public boolean locked();
    }and i implemented it in another program, can someone tell me what's wrong? i keep getting the error "int cannot be dereferenced." thx
    public void setKey(int newkey){
           int key = newkey;
       public int lock(int key_lock){
           key = key_lock;
           return key;
       public int unlock(int key_unlock){
           key = key_unlock;
           return key;
       public boolean locked(){
           if (key.lock() == key)
                return true;
           else
                return false;
            }

    if (key.lock() == key)key is an int. Ints are primitives, not references, so they don't have methods. A Lockable has a lock() method.

  • Help me with this effect PLEASE!

    I'm trying to mimic a vocal effect as heard in Rob Zombie's "Living Dead Girl"
    You can hear the effect right at the beginning of the song (after the introductory monologue line)
    The first words are "Living Dead Girl", and then the music starts. I'm trying to duplicate the effect used in that first line. Any ideas on how to do this?
    Here is a link to listen/watch the video. The line starts at 0:09 seconds in. http://www.youtube.com/watch?v=BvsMPOfblfg

    OK, so I understand the distortion, but from the beginning of the line to the end, it has an effect of getting more and more high pitched and tiny (or even tinny) sounding. If there were a way to take the audio and create a pitch curve on it, almost the same way you would do a fade curve, I think that would do it, but can Logic do that?

  • I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    Please note that running out of date versions of Firefox is not recommended, as you will open yourself up to known security issues, alongside bugs and other issues. Is there a specific problem you are having with Firefox that I can help you with?
    You can download Firefox 9 at [http://ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/ ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/]

  • Please! help me with this wrong code, where is mistake

    please! help me with this wrong code, where is mistake?
    import java.util.Stack;
    public class KnightsTour {
    Vars locs[];
    private int size, max=1, d=0, board[][];
    public KnightsTour(int x,int y, int newSize)
         size=newSize;
         locs=new Vars[size*size+1];
         for(int n=1;n<=size*size;n++)
              locs[n]=new Vars();
         board=new int[size+1][size+1];
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   board[n][n2]=0;
         locs[max].x=x;
         locs[max].y=y;
         locs[max].d=1;
         board[x][y]=max;
         max++;
    class Vars{
         int x;
         int y;
         int d;
    public void GO()
         int n=0;
         while(max<=size*size)
              n++;
              d++;
              if(d>8)
                   max--;
                   board[locs[max].x][locs[max].y]=0;
                   d=locs[max].d+1;
              move();
         printBoard();
    public void move()
         int x=locs[max-1].x, y=locs[max-1].y;
         switch(d)
         case 1:x--;y-=2;break;
         case 2:x++;y-=2;break;
         case 3:x+=2;y--;break;
         case 4:x+=2;y++;break;
         case 5:x++;y+=2;break;
         case 6:x--;y+=2;break;
         case 7:x-=2;y++;break;
         case 8:x-=2;y--;break;
         //System.out.println(" X: "+x+" Y: "+y+" |"+max);
         if((x<1)||(x>size)||(y<1)||(y>size)){}
         else if(board[x][y]!=0){}
         else
              locs[max].x=x;
              locs[max].y=y;
              locs[max].d=d;
              board[x][y]=max;
              max++;
              d=0;
              //printBoard();
    public void printBoard()
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   if(board[n2][n]<10)
                        System.out.print(board[n2][n]+" ");
                   else
                        System.out.print(board[n2][n]+" ");
              System.out.println();
         //System.out.println();
         System.out.println();
         public static void main (String[]args){
              KnightsTour k = new KnightsTour(1,1,8);
         }

    public class KnightsTour {
        Vars locs[];
        private int size,  max = 1,  d = 0,  board[][];
        public static void main (String[] args) {
            KnightsTour k = new KnightsTour (1, 1, 8);
            k.GO ();
        public KnightsTour (int x, int y, int newSize) {
            size = newSize;
            locs = new Vars[size * size + 1];
            for (int n = 1; n <= size * size; n++) {
                locs[n] = new Vars ();
            board = new int[size + 1][size + 1];
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    board[n][n2] = 0;
            locs[max].x = x;
            locs[max].y = y;
            locs[max].d = 1;
            board[x][y] = max;
            max++;
        class Vars {
            int x;
            int y;
            int d;
        public void GO () {
            int n = 0;
            while (max <= size * size) {
                n++;
                d++;
                if (d > 8) {
                    max--;
                    board[locs[max].x][locs[max].y] = 0;
                    d = locs[max].d + 1;
                move ();
            printBoard ();
        public void move () {
            int x = locs[max - 1].x, y = locs[max - 1].y;
            switch (d) {
                case 1:
                    x--;
                    y -= 2;
                    break;
                case 2:
                    x++;
                    y -= 2;
                    break;
                case 3:
                    x += 2;
                    y--;
                    break;
                case 4:
                    x += 2;
                    y++;
                    break;
                case 5:
                    x++;
                    y += 2;
                    break;
                case 6:
                    x--;
                    y += 2;
                    break;
                case 7:
                    x -= 2;
                    y++;
                    break;
                case 8:
                    x -= 2;
                    y--;
                    break;
    //System.out.println(" X: "x" Y: "y" |"+max);
            if ((x < 1) || (x > size) || (y < 1) || (y > size)) {
            } else if (board[x][y] != 0) {
            } else {
                locs[max].x = x;
                locs[max].y = y;
                locs[max].d = d;
                board[x][y] = max;
                max++;
                d = 0;
    //printBoard();
        public void printBoard () {
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    if (board[n2][n] < 10) {
                        System.out.print (board[n2][n] + " ");
                    } else {
                        System.out.print (board[n2][n] + " ");
                System.out.println ();
    //System.out.println();
            System.out.println ();
    }formatting ftw.
    If you call GO () you get in an infinite loop. max gets decreased, and it loops while max is smaller then or equal to size * size. Is your looping logic correct ?

  • Please help me with these java puzzle ?

    Dear all,
    My friend send me typical java puzzle about java.util.ArrayList
    which is getting messy. Please help me out. It's not a homework.
    Please help me with these java puzzle ?
    Dear all,
    My friend send me typical java puzzle about java.util.ArrayList
    which is getting messy. Please help me out. It's not a homework.
    import java.util.*;
    public class MyInt ______ ________ {
    public static void main(String[] args) {
    ArrayList<MyInt> list = new ArrayList<MyInt>();
    list.add(new MyInt(2));
    list.add(new MyInt(1));
    Collections.sort(list);
    System.out.println(list);
    private int i;
    public MyInt(int i) { this.i = i; }
    public String toString() { return Integer.toString(i); }
    ________ int ___________ {
    MyInt i2 = (MyInt)o;
    return ________;
    }Hints , fill the underlines with below :
    implements
    extends
    Sortable
    Object
    Comparable
    protected
    public
    i = i2.i
    i
    i2.i=i
    compare(MyInt o, MyInt i2)
    compare(Object o, Object i2)
    sort(Object o) sort(MyInt o)
    compareTo(MyInt o)
    compareTo(Object o)

    Dear all,
    My friend send me typical java puzzle aboutNotwithstanding your pathetic protestations typicial
    of all your posts this is NOT a typical java "puzzle"
    but is indeed a typical homework puzzle.
    And it's damn easy if you spent 30 minutes with a
    tutorial.
    DO YOUR OWN HOMEWORK!
    Hey i did it.
    import java.util.*;
    public class MyInt implements Comparable {
    public static void main(String[] args) {
    ArrayList<MyInt> list = new ArrayList<MyInt>();
    list.add(new MyInt(2));
    list.add(new MyInt(1));
    Collections.sort(list);
    System.out.println(list);
    private int i;
    public MyInt(int i) { this.i = i; }
    public String toString() { return Integer.toString(i); }
    public int compareTo(Object o){
    MyInt i2 = (MyInt)o;
    return i;
    }E:\>javac MyInt.java
    Note: MyInt.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    E:\>java MyInt
    [1, 2]

  • I bought a movie the movie Godzilla 2014 recently but it didn't show up in my library. I went check the itunes store and it wants me to buy it again. Please help me with this problem.

    I just bought this movie "Godzilla 2014" but it won't show in my Movie Library. I closed my Itunes and put it back on again but still won't show up. I checked my purchased list and it shows that I recently bought the movie but when I checked the itunes store it wants to buy the movie again. Please help me with this right away Apple.

    Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
    To contact product and tech support: Contacting Apple for support and service - this includes
    international calling numbers..
    For Mac App Store: Apple - Support - Mac App Store.
    For iTunes: Apple - Support - iTunes.

Maybe you are looking for

  • Zen Nano - problem I deleted a critcal file (not knowing at the time) and want to get it ba

    Hi, Sorry to bother you guys but I deleted a critical file (or it seems to be so) on the nano itself. It's totally empty but it shows that I only have 2 or so megs left! This happened after I deleted a seemingly unimportant file but I did mention som

  • Working around DB outages

    Does anyone have a strategy for working around DB outages when calling a database? For example, if I run a query, and that query takes more than 5 seconds, how do I cancel the query so my app doesn't hang waiting for the query to return? Sidebar - do

  • Upgrade oracle database 11.2.0.1.0 to 11.2.0.2.3

    We are planning to upgrade oracle database 11.2.0.1.0 to 11.2.0.2.3.My CRS is running g on 11.2.0.1.0 .Can anybody give me idea if I have to upgrade CRS from 11.2.0.1.0 to new version also . Below this oracle article confusing me Oracle Cluster ware

  • Good Issue to Account Receivable

    Dear Expert, My client has requirement to create good issue with output accounting document as below: Dr Account Receivable Cr Material Do you have any idea, if this requirement can be accommodated in MM via automatic posting? Is there any movement t

  • Always-On Node2 Server performace is very slow

    I have two node Always-On Configured (sync & Automatic) SQL serves. Node 1 Performance is very good however as soon as failover happens on Node 2 the performace becomes very slow. Both the server configurations are same.What could be the reason for d