You can write parts of a page with JavaScript like this:
<SCRIPT LANGUAGE=JavaScript>
if (userName == "")
{ document.writeln("<H3>Welcome, new user.</H3>");
}else
{ document.writeln("<H3>Welcome, " + userName + ".</H3>");
}
</SCRIPT>
This code is generated before the page gets displayed to the user. If
you want to change things after the page is loaded, you can do it by
either altering the source of graphics
(document.images["imageName"].src="images/something.gif";) or changing
the text of a defined division of the HTML. That last option requires
that the user be using a browser that can handle DHTML, such as Netscape
4 or IE4. I forget exactly how to do it, but it can be done. If it's
something you want to try, do a search for DHTML tutorials and you'll
find examples.
Russell Montgomery
Digital Renaissance
> -----Original Message-----
> From: Petr Jiricka [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, March 08, 1999 12:21 PM
> To: [EMAIL PROTECTED]
> Subject: [a little bit off topic] Generating part of a page in
> JavaScript
>
> Hi,
> Is it possible to write HTML code by JavaScript in the middle of a
> document?
> I would like to dynamically change a part of a page when user clicks a
> button on a page without having to call my servlet, because the page
> is
> quite big and it needs to change quickly.
> Thanks in advance for your help.
>
> Petr
>
> ______________________________________________________________________
> _____
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html