...

View Full Version : Console Game JQuery problem



Nieeli
12-29-2011, 02:51 PM
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


<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


//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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum