Forum Moderators: open

Message Too Old, No Replies

doubt with 2 simple scripts

         

fdle

10:47 pm on Mar 1, 2006 (gmt 0)

10+ Year Member



Please, help me to create a short script in JavaScript that writes two lines of text. The first line of text should be in Green and the second line of text in Blue.

and other that Writes one line of JavaScript that prompts the user to input his name and assigns this value to a variable called user_name. For the prompt text, use "Enter your name below.".

Itīs for an exam.
Thanks

jatar_k

10:48 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



but if we pass you exam for you then that's kind of like cheating isn't it

have you got anything so far?

fdle

10:52 pm on Mar 1, 2006 (gmt 0)

10+ Year Member



but is an exam that has very little to do with programming, itīs simply kind of extra stuff, and I have no idea of javascript...

jatar_k

10:55 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if they didn't teach you javascript then why would it be on an exam?

someone788

11:31 pm on Mar 1, 2006 (gmt 0)

10+ Year Member



I'm not so good with javascript but I'll give it a try...

The blue and green colors:

<script>
document.write("<font color='green'>Green</font><br>")
document.write("<font color='blue'>Blue</font>")
</script>

--------

And the prompt box (not sure if this was what you were looking for):

<script>
function user_name()
{
var name=prompt("Enter your name below","")
if (name!=null && name!="")
{
document.write(name)
}
}
</script>
<form>
<input type="button" onclick="user_name()" value="Enter your name below">
</form>

fdle

8:46 am on Mar 2, 2006 (gmt 0)

10+ Year Member



thanx someone