Re: Write. function




cass27 wrote:
I am just doing a course on Javascript and have begun to try out
different ideas. The effect I wanted was fro the user to click on a
graphic. Aprompt box would apprear asking their name and that imfo
would be transferred to the top of that page. However the users name
will only appear on a seperate page.

Tip 1: after the page has finished loading, document.wirte first calls
document.open, which clears the current page before writing the new
content.


The code i am using (in brief) is as follows:

function getname()
{
myname = prompt("What is your name?","");
document.write("<font size 3>Welcome</font>");

Tip 2: use a modern version of HTML. The font element was deprecated
in 1997 with HTML 4.0.


[...]
does anyone know how I cn get the users name to appear on the same page
(without using text box)? Maybe it cant be done using javascript.

Tip 3: learn about getElementById and how to change the value of a text
node.

Start with the FAQ:
<URL: http://www.jibbering.com/faq/#FAQ4_15 >

Continue at quirksmode:
<URL: http://www.quirksmode.org/ >


--
Rob

.



Relevant Pages

  • Re: Write. function
    ... The effect I wanted was fro the user to click on a ... Aprompt box would apprear asking their name and that imfo ...
    (comp.lang.javascript)
  • Re: Write. function
    ... Aprompt box would apprear asking their name and that imfo ... function getName() { ...
    (comp.lang.javascript)
  • Re: Write. function
    ... RobG wrote: ... The effect I wanted was fro the user to click on a ... Aprompt box would apprear asking their name and that imfo ... use a modern version of HTML. ...
    (comp.lang.javascript)