JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 8th, 2001, 10:51 AM
WeXXL's Avatar
WeXXL WeXXL is offline
Awake and listening...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Berlicum, the Netherlands
Posts: 127 WeXXL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 34 m 37 sec
Reputation Power: 8
Red face

I have a question:
has anybody a clue if it is possible to make a javascript at my homepage that can orden e-mailadresses from a file alphabethicly?

Note1: all e-mail adresses have a "," between them.
Note2: I haven't worked with Java-script before, so code is welcome

For instance:
current file mail.txt:
homer@junk.be, jerry@hotmail.com, al@freemail.com, etc@somethinglikethat.nl

Becomes the file mail.txt:
al@freemail.com, etc@somethinglikethat.nl, homer@junk.be, jerry@hotmail.com.

The 4 main questions are:
1. is it possible?
2. how can I read in files?
3. how can I put things alphabeticly?
4. how can I get it back in the file?


__________________
People who get a raise because of their good work have been underpayed for quite some time.

Reply With Quote
  #2  
Old March 8th, 2001, 02:25 PM
bramsey bramsey is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: USA
Posts: 226 bramsey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 40 m 35 sec
Reputation Power: 9
I would put your e-mail addresses into a database. Query the database using ASP or PHP. You can output the addresses in any order with a SQL query command.

Reply With Quote
  #3  
Old March 9th, 2001, 03:27 AM
WeXXL's Avatar
WeXXL WeXXL is offline
Awake and listening...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Berlicum, the Netherlands
Posts: 127 WeXXL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 34 m 37 sec
Reputation Power: 8
putting all in a database...

I have thought of that of putting al those e-mail adresses in a database, but I wouldn't know how(it are quite a few) adresses). Do you know an easy way to put a text file into a database?

Reply With Quote
  #4  
Old March 9th, 2001, 09:19 AM
bramsey bramsey is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: USA
Posts: 226 bramsey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 40 m 35 sec
Reputation Power: 9
I know how to do it in Access. It is probably similar in other applications.

All you have to do is go to file, get external data, and import. It is very simple.

Good luck.

Reply With Quote
  #5  
Old March 9th, 2001, 03:36 PM
datagram datagram is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Montreal
Posts: 31 datagram User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
well js is for client side scripting how do you want to open a file using a client side scripting language when the file is on the server ? you can't except if you start using JScripting for the server side and that's another story.

use a db with php/jsp/asp/cgi ...
a db can be a flat file you don't really need access ...

don't kill a fly with a nuclear bomb
__________________
-patrick

Reply With Quote
  #6  
Old March 9th, 2001, 03:39 PM
bitdamaged bitdamaged is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 bitdamaged User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to bitdamaged
Lightbulb

Javascript can't read or write to other files. It's completely client side.

Here's the basic JS for what you want to do
<script>
mystring = 'homer@junk.be, jerry@hotmail.com, al@freemail.com, etc@somethinglikethat.nl';
myArray = mystring.split(',');
myArray = myArray.sort();
for (i=0;i<myArray.length; i++){
document.write(myArray[i]+'<br>');
}
</script>

The thing is to read these files you need to do something to read from the server. You can use a server side include. where it would be something like this.

mystring = '<!--#include virtual="/pathtotext/email.txt"-->'
myArray = mystring.split(',');
myArray = myArray.sort();
for (i=0;i<myArray.length; i++){
document.write(myArray[i]+'<br>');
}

That should work on most servers. The thing is to write to a new file you will need to use some sort of scripting language, perl, PHP etc. and if you have to use one of those anyway then you might as well do the whole shebang in that language instead of using JS at all.

cheers

Reply With Quote
  #7  
Old March 11th, 2001, 07:49 AM
WeXXL's Avatar
WeXXL WeXXL is offline
Awake and listening...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Berlicum, the Netherlands
Posts: 127 WeXXL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 34 m 37 sec
Reputation Power: 8
Thumbs up eh...filewriting


Thanks all. I think I have something I wanted to see.
I'll probably put it all in a textbox on the webpage, that shouldn't be to hard, I believe.


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > javascript for orderening e-mail adresses


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT