hello, fellow computer geeks.
I seem to be having a problem with this javascript code. It's for a new game that I am making in cloud9.io's developer.
when I run it, it executes everything up to the document.write("<img src='loading.gif' id='load' />"); and ignores everything else. I can't seem to get it to work at all, and it is really messing me up. Thanks in advance.

<!DOCTYPE html>

<html lang="en-us">

    <head>
        <title>(it's better fullscreen!)</title>

        <script type= "text/javascript">
            document.write("<img src='loading.gif' id='load' />");
            function weapon(namme, slot) {
                this.name = namme;
                this.damage;
                switch (this.slot) {
                    case (1): //pistols
                        switch (this.name) {
                            case ("pistol cs-barret"):
                                this.damage = 5;
                                break;
                            case ("alien pistol"):
                                this.damage = 2;
                                break;
                            case ("here comes the boom"):
                                this.damage = 7;
                                break;
                            case ("nothing"):
                                this.damage = 0;
                                break;
                        }
                        break;
                    case (2): //auto rifles
                        switch (this.name) {
                            case ("rifle C-01R"):
                                this.damage = 3;
                                break;
                            case ("alien bubble blaster"):
                                this.damage = 4;
                                break;
                            case ("boom boom boom boom"):
                                this.damage = 7;
                                break;
                            case ("nothing"):
                                this.damage = 0;
                                break;
                        }
                        break;
                    case (3): //shotguns
                        switch (this.name) {
                            case ("shotgun C-01S"):
                                this.damage = 3;
                                break;
                            case ("alien sheeawtguhn"):
                            this.damage = 3;
                                break;
                            case ("bang bang bang bang"):
                                this.damage = 8;
                                break;
                            case ("nothing"):
                                this.damage = 0;
                                break;
                        }
                        break;
                    case (4): //long-ranges
                        switch (this.name) {
                            case (".50 cal sniper"):
                                this.damage = 5;
                                break;
                            case ("Holy grail! that's one holy grail."):
                                this.damage = 70;
                                break;
                            case ("nananaa naa, nananaa naa"):
                                this.damage = 90;
                                break;
                            case ("nothing"):
                                this.damage = 0;
                                break;
                        }
                        break;
                    case (5): //heavies
                        switch (this.name) {
                            case ("EPIC EX PLOAGH SHUN"):
                                this.damage = 7;
                                break;
                            case ("BEEWM"):
                                this.damage = 8;
                                break;
                            case ("HEY HEY HEY, GUDBIGH"):
                                this.damage = 10;
                                break;
                            case ("nothing"):
                                this.damage = 0;
                                break;
                        }
                        break;
                }

                this.image = name + ".png";
            }
            document.write("weapon class, line 99");
            function character(namme) {
                this.health = 300;
                this.name = namme;
                this.x = 50;
                this.y = 50;
                this.imageloc = "player.png";
                this.alive = true;
                this.weapon[5];
                this.weapon[1] = new weapon("pistol cs-barret", 1);
                this.weapon[2] = new weapon("nothing", 2);
                this.weapon[3] = new weapon("nothing", 3);
                this.weapon[4] = new weapon("nothing", 4);
                this.weapon[5] = new weapon("nothing", 5);
            }

            enum direction {
                LEFT = "left";
                RIGHT = "right";
                UP = "up";
                DOWN = "down";
            }
            var fdsa = direction.LEFT;
            weapon gun = new weapon("boom boom boom boom", 3);
            var name = prompt("What is your name?");
            character player = new character(name);
            document.getElementById('load').style.display='none'; //remove the loading image from display
        </script>
    </head>
    <body>

    </body>
</html>

I think wriring html code within script is creating problem, keeep document.write fucntion comented or write them with with normal/standard html

well, i deleted the enum, and the problem is that it just isn't executing the document.write and writeln, period. i commented out everything except the document.write, and it isn't doing anything. My cloud9 url is: https://c9.io/mblan180131/raze_burst_1-1

if you want to collaborate with me, my normal times are from 4:00PM to 5:30PM, and from 7:00PM to 8:45PM.

AAAAAH ITS NOT WORKING ITS NOT YOU ITS THE C9 COMPILER I THINK BUT STILL BRAIN F***!
Member Avatar for diafol

if you want to collaborate with me, my normal times are from 4:00PM to 5:30PM, and from 7:00PM to 8:45PM.

Heh heh. Timezone would have been useful. heh heh heh.

Member Avatar for diafol

You may consider toning that down a bit mb. My eyes are hurting, confusing my brain, which thinks my ears should be hurting.

<!DOCTYPE html>
<html lang="en-us">
    <head>
        <title>(it's better fullscreen!)</title>
        <script type= "text/javascript">
            document.write("<img src='loading.gif' id='load' />");
            function weapon(namme, slot) {
                this.name = namme;
                this.damage;
                //this.slot;
                switch (this.slot) {
                    case 1: //pistols
                        switch (this.name) {
                            case "pistol cs-barret":
                                this.damage = 5;
                                break;
                            case "alien pistol":
                                this.damage = 2;
                                break;
                            case "here comes the boom":
                                this.damage = 7;
                                break;
                            case "nothing":
                                this.damage = 0;
                                break;
                        }
                        break;
                    case 2: //auto rifles
                        switch (this.name) {
                            case "rifle C-01R":
                                this.damage = 3;
                                break;
                            case "alien bubble blaster":
                                this.damage = 4;
                                break;
                            case "boom boom boom boom":
                                this.damage = 7;
                                break;
                            case "nothing":
                                this.damage = 0;
                                break;
                        }
                        break;
                    case 3: //shotguns
                        switch (this.name) {
                            case "shotgun C-01S":
                                this.damage = 3;
                                break;
                            case "alien sheeawtguhn":
                            this.damage = 3;
                                break;
                            case "bang bang bang bang":
                                this.damage = 8;
                                break;
                            case "nothing":
                                this.damage = 0;
                                break;
                        }
                        break;
                    case 4: //long-ranges
                        switch (this.name) {
                            case ".50 cal sniper":
                                this.damage = 5;
                                break;
                            case "Holy grail! that's one holy grail.":
                                this.damage = 70;
                                break;
                            case "nananaa naa, nananaa naa":
                                this.damage = 90;
                                break;
                            case "nothing":
                                this.damage = 0;
                                break;
                        }
                        break;
                    case 5: //heavies
                        switch (this.name) {
                            case "EPIC EX PLOAGH SHUN":
                                this.damage = 7;
                                break;
                            case "BEEWM":
                                this.damage = 8;
                                break;
                            case "HEY HEY HEY, GUDBIGH":
                                this.damage = 10;
                                break;
                            case "nothing":
                                this.damage = 0;
                                break;
                        }
                        break;
                }
                this.image = name + ".png";
            }
            document.write("weapon class, line 99");

            function character(namme) {
                this.health = 300;
                this.name = namme;
                this.x = 50;
                this.y = 50;
                this.imageloc = "player.png";
                this.alive = true;
                this.weapon=new Array(); //Modified 
                this.weapon[1] = new weapon("pistol cs-barret", 1);
                this.weapon[2] = new weapon("nothing", 2);
                this.weapon[3] = new weapon("nothing", 3);
                this.weapon[4] = new weapon("nothing", 4);
                this.weapon[5] = new weapon("nothing", 5);
            }

            var direction= { //Modified 
                LEFT : "left", //Modified 
                RIGHT : "right", //Modified 
                UP : "up", //Modified 
                DOWN : "down" //Modified 
            }

            var fdsa = direction.LEFT;
            var gun = new weapon("boom boom boom boom", 3);//Modified 
            var name = prompt("What is your name?");
            var player = new character(name);//Modified 

            document.getElementById('load').style.display='none'; //remove the loading image from display
        </script>
    </head>
    <body>
    </body>
</html>

Mostly the things you got wrong are syntax errors.
The line I've altered are tailed as "Modified" comment, Please check them out.
Some points here:
The enum is a javascript reserved word you can't use anymore.
Javascript always use var to delcare whatover type of data or objects.
In switch statment the parentheses in case expression can be omitted.

You code is working now.

commented: single most helpful thing in the entire universe. +0
O.O OH MYGOSH YOU ARE A SAINT DIAFOL THANK YOU SO MUCH!
Member Avatar for diafol

Heh heh

DUDE i was so immature back then I'm pretty sure I thought I was married to the Bold button X-D

P.S. I deleted this project at least a year ago

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.