One of the html files at our site is a form where the user is asked to
fill in personal information (name, email address etc). I have written
some javascript code that saves the information in cookis so that next
time the form is used the information gets filled in automatically.
Everything works fine unless the piece of information filled in is more
than one word. For example, if the department name is Computing Center,
what gets put into the form the next time around is only Computing without
Center. I checked the cookies file and both words are recorded in the
cookie - it gets written as Computing%20Center which is as it should be.
So the problem seems to be in retrieving the cookie or in writing it.
Here is the code that retrieves the cookie:
// Use this function to retrieve a cookie.
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
var a = " ";
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return a;
}
The cookie is written to the form with the code
document.write(getCookie("Depart_Name"));
If I take put the unescape from the line
return unescape(dc.substring(begin, end));
then what gets written in the form is Computing%20Center
How can I get it to write Computing Center
You can see alive example of what I am trying to do at
http://www.weizmann.ac.il/CC/test/copy.html
Thanks for any help.
Malki Cymbalista
Software Support, Weizmann Institute Computing Center
Rehovot, Israel 76100
Internet: [EMAIL PROTECTED]
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------