From - Sat Jun 14 22:57:03 1997
Path: world1.bellatlantic.net!out2.nntp.cais.net!news2.cais.com!news.intr.net!news.charm.net!news.fred.net!news.iac.net!stdio!news-feed.inet.tele.dk!news.maxwell.syr.edu!newsfeed.nacamar.de!news-xfer.cybernet.dk!news.kolumbus.fi!news.funet.fi!news.helsinki.fi!not-for-mail
From: Atro Tossavainen <Atro.Tossavainen@kill-spam-helsinki.fi>
Newsgroups: comp.lang.javascript
Subject: Re: [Q] - Form INPUT Values and Inserting Cookies??!!??
Date: 06 Jun 1997 12:55:46 +0300
Organization: University of Helsinki
Lines: 28
Message-ID: <pgzyb8of42l.fsf@kontti.Helsinki.FI>
References: <339338D1.2510@miso.wwa.com> <3394332F.866B3013@ti.com>
	<3394E3DA.13B6@miso.wwa.com>
NNTP-Posting-Host: kontti.helsinki.fi
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: Gnus v5.3/Emacs 19.34

Wef <wef@miso.wwa.com> writes:

> Janeen Reich wrote:
>> I've had some luck trying this:
>> 
>> document.write("<input type=text name=\"name\" value=" + cookieval +
>> "size=30><---Your Name<br>");

> This helped very much! But now I'm having difficulties when the cookie
> value has more than one word in it...  The text input box displays only
> the first word in the cookie...  

This happens because the value is not quoted properly and the browser
thinks the rest of the value string are attributes for the INPUT tag.

I'd do this:	document.write('<INPUT TYPE=text NAME=name VALUE="' +
		cookieval + '" SIZE=30>&lt;---Your Name<BR>');

If you use single quotes to delimit your write() contents, you can have
the double quotes where you need them without any extra work, even around
the name field (name="name"), even though it's not strictly necessary.

Note I changed the < to &lt; in "<--- Your Name", too, because otherwise
the "less than" character would indicate the beginning of a tag.

-- 
Atro Tossavainen		E-mail: Atro.Tossavainen@helsinki.fi
				http://www.helsinki.fi/~atossava/
