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 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Location
    Belgium
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Console Game JQuery problem

    Hi, i'm having problems with my console game, when i type in help when testing it just doesn't do anything, it's probarly a stupid mistake but i can't find what i did wrong :s

    index.html code
    Code:
    <html>
    <head>
    <script type="text/javascript" src="scripts/jquery.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Console Game Project</title>
    </head>
    <body>
    
    <div id="console">
    
    <p id="message_startgame">Welcome to Nieli's game! To control the game you must type in commands</p>
    
    <p id="area_northcorridor">You are in the north door. There is a sword on the ground.</p>
    
    <p id="message_help" style="display: none;">Here is a list of commands</p>
    
    <!--
    PLACEHOLDER: THIS IS WHERE EVERYTHING WILL BE INSERTED BEFORE
    -->
    
    <div id="placeholder"></div>
    
    <form onsubmit="return false;">
    <input type="text" size="50" autofocus="autofocus" id="command_line" />
    </form>
    
    </div>
    
    <script type="text/javascript" src="scripts/game.js"></script>
    
    </body>
    </html>
    game.js code
    Code:
    //been to variables
    beentonorthdoor = true;
    //
    //Item variable
    sword = false;
    //
    //Current room
    currentroom = "n_corridor";
    //
    
    $(document).ready(function() {
    	$("form").submit(function() {
    		var input = $("#command_line").val();
    		
    		if (input == "help") {
    			$("#message_help").clone().insertBefore("#placeholder").fadeIn(1000);
    		}
    		
    		$("#command_line").val("");
    	}};	
    }};
    I have on my website ( www.nieeli.com/game/ ) the index.html, then a folder scripts with jquery.js and game.js in..

    Could anyone help me

    Oh, just noticed there is a Jquery help section... Sorry
    Last edited by Nieeli; 12-29-2011 at 02:53 PM. Reason: wrong category


 

Posting Permissions

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