Javascript problem (please help!)

Posted by: jonlenin

Javascript problem (please help!) - 03/04/04 01:33 AM

Hey guys,

I read a couple of tutorials and started learning how to program javascript. I tried to do one of the excercises, and the code just doesnt work could someone please help me out? sorry about the weird spacing
Code:
  
<html>
<head>
<title>stuff</title>
<script language ="Javascript">
<!-- hide me
var red_monkey = prompt("What is your name?","Ryan");

var blue_monkey = prompt("what is your favorite color?""Blue");

var green_monkey = "I hate you";

var orange_monkey = "and I hate";

var all_in_one = green_monkey + red_monkey + orange_monkey + blue_monkey;
// stop hiding me -->
</script>
</head>

<body>
<script language = "javascript">
<!-- hide me
document.writeln(all_in_one)
// stop hiding me -->
</script>
</body>
</html>
Posted by: §intå×

Re: Javascript problem (please help!) - 03/04/04 02:20 AM

Not sure if that is what you want, but try that. You were missing a comma...


Code:
var blue_monkey = prompt("what is your favorite color?""Blue");
>
>
>
this should have been 
>
>
>
var blue_monkey = prompt("what is your favorite color?","Blue");
                                                       ^
                                                       Notice the comma
This is the code corrected

Code:
 <html>
     <head>
        <title>stuff</title>
  <script language ="Javascript">
  <!-- hide me
    var red_monkey = prompt("What is your name?","Ryan");
    var blue_monkey = prompt("what is your favorite color?","Blue");
    var green_monkey = "I hate you";
    var orange_monkey = "and I hate";
    var all_in_one = green_monkey + red_monkey + orange_monkey + blue_monkey;
  // stop hiding me -->
  </script>
     </head>
<body>
<script language = "javascript">
  <!-- 
     hide medocument.writeln(all_in_one)
  // stop hiding me -->
</script>
</body>
</html>
Posted by: jonlenin

Re: Javascript problem (please help!) - 03/05/04 02:29 AM

Thank you very much sin_tax. this is why programing can sometimes be suck a pain.
Posted by: §intå×

Re: Javascript problem (please help!) - 03/05/04 03:27 AM

Sure, just keep coming back. You are what this site needs more of. You are already my favorite newbie. You come here seeking knowledge but are already looking for it on your own. I will help guys like you out all day.

Good luck.