Anybody that knows some javascript want to help me out?
I had my html file and it is linked to my .js and it was working perfectly, everything showing up on the screen, although I was using confirm( ) and prompt( ) a ton. I tried my .html after a bit of editing, now nothing will show up. So I tried it with a new .js file and only had confirm( " Show up? "); and still nothing. Anybody know why?
This is my .html (really simple, I'm pretty sure nothing is wrong with it)

Code:

<!DOCTYPE html>
<html>
   <head>
      <title>CYOA-Daniel T</title>
   </head>
   <body>
      <script type="text/javascript" src="NCYOA.js"></script>
   </body>
</html>


Here is the .js file: (a basic text adventure game for my little brother)
http://pastebin.com/tiJSTLDv

Code:
... Message1 + Location [0] + ...

NAE, but a seemingly innocuous space before the bracket there.
Hmm, I fixed both of those and still nothing. As I said before I tried it on a blank .js file except for

Code:

comfirm( "Work!");

And even that didn't show up. I'm not sure it is a problem with my .js code but rather my browser? My CSS shows up as well. Just no javascript.
I loaded your source into Firefox and opened the Error Console (Ctrl+Shift+J), and it gave me this:

Quote:
Timestamp: 7/10/2013 7:55:19 PM
Error: SyntaxError: missing ; before statement
Source File: file:///[...]/NCYOA.js
Line: 22, Column: 16
Source Code:
var Enemy_Names ("Goblin","Skeleton","Orc","Dark Knight","Demon","Dragon","G

It needs an equals sign, it looks like.
The prompts and confirms at the beginning aren't "triggering", even after I fixed the =new Array(blah); code bit. The while loop I have in there isn't looping either. It feels as if it is ignoring my whole .js file.
The next error is on line 128. Why not give the Error Console a whirl?
That sounds smart, I'll go hit that for a while.
Well thanks to Weregoose, it works again. I'll be sure to use that debugger more often before asking lame questions! Thanks.
I reached the King!
After fixing several rather annoying bugs with the help of Weregoos I have an update it includes:
-fixed enemy ambush rate (may be too much)
-different objects, depending on location.
-fixed attack code
http://pastebin.com/duV83sPD
*try the wizard out because he has a healing spell (;
Nope wizard doesn't work. I'll fix that for v.02
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement