UGN Security
Posted By: jonlenin Javascript problem (please help!) - 03/04/04 09: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 10: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 10: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 11: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.
© UGN Security Forum