By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,781 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,781 IT Pros & Developers. It's quick & easy.

Store the answer to a question

P: n/a
I want to ask a visitor the reason they visited our website using
javascript:

Var strReason = Prompt("Why did you visit?")

How can I store this in a text file or Access database?

TIA
Mark
Feb 1 '08 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Mark1234567 wrote:
I want to ask a visitor the reason they visited our website using
javascript:

Var strReason = Prompt("Why did you visit?")

How can I store this in a text file or Access database?
Hi,

How? By posting the answer to your server, and handle it from there.
JavaScript can, at most, help you post it, but it cannot store in in a
database, or flat file.

You need to use a serversidelanguage for that, like PHP.
(Actually, JavaScript can also be used serverside, but that is rare.)

Regards,
Erwin Moller
>
TIA
Mark
Feb 1 '08 #2

P: n/a
Mark1234567 wrote:
I want to ask a visitor the reason they visited our website using
javascript:

Var strReason = Prompt("Why did you visit?")

How can I store this in a text file or Access database?
In 99.x% of the cases, you have three options:

- You can store it in a file at server;
- You can store it in a database at server (e.g. Access);
- You can store it in a cookie at client.

Hope this helps,

--
Bart
Feb 1 '08 #3

P: n/a
Do you know what the Javascript code would be to store it in a flat
file on our server?
On Feb 2, 10:40*am, Bart Van der Donck <b...@nijlen.comwrote:
Mark1234567 wrote:
I want to ask a visitor the reason they visited our website using
javascript:
Var strReason = Prompt("Why did you visit?")
How can I store this in a text file or Access database?

In 99.x% of the cases, you have three options:

- You can store it in a file at server;
- You can store it in a database at server (e.g. Access);
- You can store it in a cookie at client.

Hope this helps,

--
*Bart
Feb 1 '08 #4

P: n/a
Do you have any Javascript code that would do this?
On Feb 1, 10:38*pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
Mark1234567 wrote:
I want to ask a visitor the reason they visited our website using
javascript:
Var strReason = Prompt("Why did you visit?")
How can I store this in a text file or Access database?

Hi,

How? By posting the answer to your server, and handle it from there.
JavaScript can, at most, help you post it, but it cannot store in in a
database, or flat file.

You need to use a serversidelanguage for that, like PHP.
(Actually, JavaScript can also be used serverside, but that is rare.)

Regards,
Erwin Moller


TIA
Mark- Hide quoted text -

- Show quoted text -
Feb 1 '08 #5

P: n/a
Mark1234567 wrote:
On Feb 2, 10:40 am, Bart Van der Donck <b...@nijlen.comwrote:
>Mark1234567 wrote:
>>I want to ask a visitor the reason they visited our website
using javascript:
Var strReason = Prompt("Why did you visit?")
How can I store this in a text file or Access database?
>In 99.x% of the cases, you have three options:
- You can store it in a file at server;
- You can store it in a database at server (e.g. Access);
- You can store it in a cookie at client.
Do you know what the Javascript code would be to store it in a flat
file on our server?
It is not possible to perform such a task in client-side javascript.
You need a server-side language for that (PHP, ASP, ...).

--
Bart
Feb 1 '08 #6

P: n/a
Mark1234567 wrote on 01 feb 2008 in comp.lang.javascript:
On Feb 1, 10:38*pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
>Mark1234567 wrote:
I want to ask a visitor the reason they visited our website using
javascript:
Var strReason = Prompt("Why did you visit?")
How can I store this in a text file or Access database?

Hi,

How? By posting the answer to your server, and handle it from there.
JavaScript can, at most, help you post it, but it cannot store in in a
database, or flat file.

You need to use a serversidelanguage for that, like PHP.
(Actually, JavaScript can also be used serverside, but that is rare.)
Perhaps it is rare to you Erwin, but not to the cyberworld.

[Please do not toppost on usenet]
Do you have any Javascript code that would do this?
You can user scripting.filesystemobject for that.

This is for appending text, I think [not tested]:

var theFile = server.mapPath('myFile.txt');
var fso = new ActiveXObject('Scripting.FileSystemObject');
var o = fso.OpenTextFile(theFile, 8, true,0);
o.write(sText);
o.close();
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 1 '08 #7

P: n/a

"Mark1234567" <Au************@gmail.comwrote in message
news:94**********************************@j78g2000 hsd.googlegroups.com...
Do you know what the Javascript code would be to store it in a flat
file on our server?

Is your server MS IIS? If so, then ASP with Javascript is apparently what
you're insisting on using.
Is your page an 'ASP' - or HTML page?
In other words, What is the existing condition?
Feb 2 '08 #8

P: n/a
VK said the following on 2/4/2008 3:25 PM:

<snip>
The overall future of Javascript is rather cloudy now, especially with
possible changes in the camp 2) with Yahoo! currently considering the
acquisition proposal from Microsoft
http://yhoo.client.shareholder.com/p...leaseID=291270
If you can't beat them, buy them out :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 4 '08 #9

P: n/a
VK
acquisition proposal from Microsoft
http://yhoo.client.shareholder.com/p...cfm?ReleaseID=...

If you can't beat them, buy them out :)
Yeah, I'm getting tired to go away to the West... Strange people with
thunder sticks are still coming sooner or later to the land... :-)

First I dropped Hotmail, now my ol'good Yahoo! Mail, now what? over
the mountains to GMail? :-)

They did not say "yes" though.

Feb 4 '08 #10

P: n/a
VK
On Feb 5, 12:22 am, VK <schools_r...@yahoo.comwrote:
They did not say "yes" though.
... yet
Feb 4 '08 #11

P: n/a
VK said the following on 2/4/2008 4:24 PM:
On Feb 5, 12:22 am, VK <schools_r...@yahoo.comwrote:
>They did not say "yes" though.
... yet
Money talks. If MS' decides they want Yahoo! bad enough, they will get
Yahoo! and it actually makes decent business sense to buy Yahoo!. They
get YUI, the IM area, and all the advertising.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 4 '08 #12

P: n/a
Wow, nice longggg answer to the poor guy.
Mark, why not just use a form field and save the response?
On Feb 1, 1:12*am, Mark1234567 <Audit.Orbis...@gmail.comwrote:
I want to ask a visitor the reason they visited our website using
javascript:

Var strReason = Prompt("Why did you visit?")

How can I store this in a text file or Access database?

TIA
Mark
Feb 5 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.