View Full Version : Phonebook in JavaScript-Is it posible?
Phantom.
09-05-2004, 03:17 PM
Hy.I'm absolutely new here. :)
I would like to make a program in JavaScript that would store names,
phonenumbers(cell,home,company),adresses and would have a daily organizer ,that could be edited by the user.
And my biggest problem is how to make it remember.
Can it be made with cookies?
And I would like it to work in NS4.
Thanks.
squirellplaying
09-05-2004, 04:48 PM
You could use a 2d-array. Something along the lines of this.
var phoneBook = new Array();
phoneBook[0] = new Array();
phoneBook[0][0] = "First Name";
phoneBook[0][1] = "Last Name";
phoneBook[0][2] = "Address";
phoneBook[0][3] = "City";
etc....
I'm not sure if it will work in NS4. I don't have netscape4 to test, and I never code for ns4 since it's becoming obsolete.
I don't understand the cookie question? How would cookies do anything.
Philip M
09-05-2004, 04:50 PM
JavaScript has no ability to write to a file or store information which is subject to change. Cookies are limited to (I think) 4K bytes.
You need a server-side language to do what you want.
Willy Duitt
09-05-2004, 05:06 PM
Cookies were originaly created by Netscape....
The Netscape reference has these limits:
300 total cookies in the cookie file.
4 kb per cookie, for the sum of both the cookie's name and value.
20 cookies per server or domain (completely specified hosts and domains are treated as separate entities and have a 20-cookie limitation for each, not combined).
You could, theoreticly, break your script up to set three seperate cookies... One for name, one for address and another for phone number(s)... this would provide you the ability to increase your phone book....
However, this should be done serverside.... Anyone would find it distressing to update this phone book and find their information missing when and if they cleared their cookies (particularly the unwary).... Besides... a user would not be able to access their phone book from another 'puter other than the one it was set up with...
......Willy
BTW: Javascript can read/write to a file using a combination of ActiveX and the File Scripting Object... But at best, this is IE only and not cross-browser...
JS can write XML. JScript can write to client files using ActiveX. Javascript can do the same for Moz using XPCOM, i believe. so, in theory in should be possible to use JS to do your phonebook, but in all honesty it makes much more sense to do this serverside.
Phantom.
09-06-2004, 01:13 PM
I know it would be better to do it server side but I would prefer it as a clientside application in JavaScript.
I know NS4 is obsolete but thats all I have. :( .
So it's not possible.
Thanks anyway.
:)
I know NS4 is obsolete but thats all I have.
wot do you mean by this: is it all YOU have on your machine, or is it all you're developing for.
if it's the former, can't you upgrade? and if it's the latter, can't your users upgrade too?
btw: is this a college project - sounds suspiciously like it!
Phantom.
09-07-2004, 03:04 PM
wot do you mean by this: is it all YOU have on your machine, or is it all you're developing for.
if it's the former, can't you upgrade? and if it's the latter, can't your users upgrade too?
btw: is this a college project - sounds suspiciously like it!
No it's not.I'm not in college yet.It was just an idea.
And it's the only thing I have on my machine. :o .
Well that's life.
it's the only thing I have on my machine.
sorry to hear that. unless you've got a very old machine, you should be able to run Firefox no problem - it's got a small filesize, so it wouldn't take too long to download.
developing for NN4 will really hamper the applications usability, since a tiny number of users will using it. indeed, next to no one is. furthermore, doing a phonebook clientside is limiting enough, but in NN4 you really are limited to only using cookies to store the info, and therefore you really won't be able to store very much at all.
good luck anyway (you'll need it LOL) :)
Phantom.
09-10-2004, 09:59 AM
sorry to hear that. unless you've got a very old machine, you should be able to run Firefox no problem - it's got a small filesize, so it wouldn't take too long to download.
developing for NN4 will really hamper the applications usability, since a tiny number of users will using it. indeed, next to no one is. furthermore, doing a phonebook clientside is limiting enough, but in NN4 you really are limited to only using cookies to store the info, and therefore you really won't be able to store very much at all.
good luck anyway (you'll need it LOL) :)
What are the system requirements for Firefox?
You say that in NS4 I am limited only to cookies.In other browsers do I have any other posibilities?
What are the system requirements for Firefox?
go to Mozilla.org and find out.
You say that in NS4 I am limited only to cookies.In other browsers do I have any other posibilities?
in modern browsers you can import XML. in IE you can even save that to the client-machine (tho there are security issues with that). not so sure about saving XML in FF, tho I've heard you can using its add-on tech XPConnect. if you respectively to MSDN and Mozilla you'll prolly find out whether you can or not.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.