| |
| | Joined: Feb 2004 Posts: 7 Junior Member | | Junior Member Joined: Feb 2004 Posts: 7 | 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
<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> | | | |
▼ Sponsored Links ▼
▲ Sponsored Links ▲
| | | | Joined: Dec 2002 Posts: 3,255 Likes: 3 UGN Elite | | UGN Elite Joined: Dec 2002 Posts: 3,255 Likes: 3 | Not sure if that is what you want, but try that. You were missing a comma... 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 commaThis is the code corrected <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> | | | | | Joined: Feb 2004 Posts: 7 Junior Member | | Junior Member Joined: Feb 2004 Posts: 7 | Thank you very much sin_tax. this is why programing can sometimes be suck a pain. | | | | | Joined: Dec 2002 Posts: 3,255 Likes: 3 UGN Elite | | UGN Elite Joined: Dec 2002 Posts: 3,255 Likes: 3 | 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. | | |
Posts: 7,204 Joined: February 2002
| | | Forums41 Topics33,839 Posts68,797 Members2,177 | | Most Online73,244 Nov 9th, 2025 | | | |
| |