Click to See Complete Forum and Search --> : Danger! Newbie! Danger!


XaieL
11-27-2003, 12:01 PM
Bah, welcome to the land of the incoherent! Yep, that's me. I've started using Javascript (Today being my first day using it) I'm not quite proficient in it, as you'll soon see. I have simple code to create and I cant even do it. Need a little help.

I'm trying to create an html file with js to prompt the user for input of his/her name. THen display the "name + enjoy your visit" on the page. Also the name is supposed to be in: Italics, Bolded, Font = green, and Should be Uppercase.

Now i know this is extremely easy and I'm probably wasting all of your valuable time but I didnt know where else to turn :P Here's the Code, Now could someone either tell me how to fix it, what to add, or what I've done wrong so Far.

<html><head><title>Test</title></head>

<script language="Javascript">

<!--Hide Me

//create a prompt box

var name = prompt("Please Input Your Name", "");

var say = "enjoy your visit!";

//declare more variables

var name_say = name + say

var name_say_italic = name_say.italics();

var name_say_bold = name_say.bold();

var name_say_fontcolor("green")

var name_say_upper = name_say toUppercase();

//end hiding --)

</script>
</head>

<body>

<h1><b><i><font color="green">Hello</h1>

<script language="Javascript">
<!--Hide Me

//document write lines

document.writeln(name_say_bold + "<br>");
document.writeln(name_say_italics + "<br>");
document.writeln(name_say_upper + "<br>");
document.writeln(name_say_green + "<br>");

//show me --!>
</body>
</script>
</html>

Thanks a lot, Derek

diamonds
11-27-2003, 12:05 PM
yes, you turned to the right place.

I think you are missing a dot (" . ") on the line:
var name_say_upper = name_say toUppercase();
it should be:
var name_say_upper = name_say.toUppercase();

And changing the subject to somthing like "error in greeting script", could help attract people to the post.
but you can add somthing like " - newbe needs help" to the end is o.k. I guess.

biff
11-27-2003, 12:14 PM
no offense, but i can't stand those things. you might wanna think twice about having one. whenever i go to a page that does that to me, i put 'bite me' in the box.:)

fredmv
11-27-2003, 12:29 PM
<script type="text/javascript">
//<![CDATA[
document.write("<span style='text-transform: uppercase; font-style: italic; font-weight: bold; color: #090;'>" + prompt('Enter your name:', '') + ", enjoy your visit!</span>");
//]]>
</script>

XaieL
11-27-2003, 12:45 PM
Thanks a Lot fred, appreciate the help :)

fredmv
11-27-2003, 12:58 PM
No problem. ;)