473,503 Members | 9,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can not get alert to call from setTimeout

Is there any reason why this code wouldn't prompt someone to save their
work every 5 minutes? It doesn't seem to be working. This code shows up
in the HEAD of an HTML document.

function saveYourWorkReminder() {
alert("It's been 5 minutes. Please save your work. Web browsers are
buggy and crash often. Protect yourself!");
}

setTimeout("saveYourWorkReminder", 300000);

Jul 23 '05 #1
12 1635
<lk******@geocities.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Is there any reason why this code wouldn't prompt someone to save their
work every 5 minutes? It doesn't seem to be working. This code shows up
in the HEAD of an HTML document.

function saveYourWorkReminder() {
alert("It's been 5 minutes. Please save your work. Web browsers are
buggy and crash often. Protect yourself!");
}

setTimeout("saveYourWorkReminder", 300000);


Perhaps missing parentheses?

setTimeout("saveYourWorkReminder()", 300000);
BTW, what does your inteneded audience do with a Web browser that require
them to save their work? What would they save and how would they retrieve
it later?
Jul 23 '05 #2
McKirahan wrote:
<lk******@geocities.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Is there any reason why this code wouldn't prompt someone to save their work every 5 minutes? It doesn't seem to be working. This code shows up in the HEAD of an HTML document.

function saveYourWorkReminder() {
alert("It's been 5 minutes. Please save your work. Web browsers are
buggy and crash often. Protect yourself!");
}

setTimeout("saveYourWorkReminder", 300000);
Perhaps missing parentheses? setTimeout("saveYourWorkReminder()", 300000);


(snip)

You can use a function pointer (function name without parentheses), but
it's a variable name and so takes no quotes:

setTimeout(saveYourWorkReminder, 300000);

The alert string needs to be on one line (probably is where you are).

Why not pop up a link to a decent web browser? :o

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
Thank you. I'll write it like this:

setTimeout("saveYourWorkReminder()", 300000);

When you say "decent web browser" are you speaking of one that allows
you to save the stuff you are writing in a textarea? I was in a big
online discussion about this problem perhaps 11 months ago and at that
time it seemed that there were no browsers that did a reasonable job as
word processors. Have things changed? What are you referring to?

Jul 23 '05 #4
Personally, I'm tired of losing my work because some web browser has
crashed. I do a lot of my best writing in the textarea box of some
form. I hate losing work and yet it happens often. Some of the best
weblog posts I've ever written ceased to exist because the web browser
I was using crashed. Some of the best love letters I've ever written
never reached their audience because of the damned browser. For a lot
of people, web browsers have replaced word processors as the place
where they do most of their writing. Yet you can not save your work
when you are in a web browser. It is painful to spend an hour on a
letter and then the browser crashes and you lose all your work.

But the browsers are not the only source of trouble when it comes to
writing online. Most email companies will end your session without
warning and without saving your work. If you spend an hour writing a
love letter in Hotmail and then hit "Send", Hotmail will wipe out your
work and take you back to the login screen.

Me and some friends have been working on a content management system,
and we hope to mitigate these problems. Ultimately, it is a problem
that the browser vendors need to solve, but till that day we are using
common sense and javascript to offer what minor protections we can.
With our software, when your session ends you get taken back to the
login screen, just like in Hotmail, but everything you just posted is
shown on the screen, so you can copy it, log back in, and paste it into
a form. That's a minor protection we offer that I wish Hotmail and
Yahoo and Earthlink offered. Also, we have a "Save" button sitting
above our textarea boxes. The save button doesn't do anything more than
grab the text in the textarea and send it to a new window, but at least
you can then save that new window to your harddrive and get some of the
protection you might expect to get by saving often in a word processor.

Jul 23 '05 #5
JRS: In article <ktFtd.628430$mD.506587@attbi_s02>, dated Wed, 8 Dec
2004 15:54:56, seen in news:comp.lang.javascript, McKirahan
<Ne**@McKirahan.com> posted :

BTW, what does your inteneded audience do with a Web browser that require
them to save their work? What would they save and how would they retrieve
it later?


When filling in a large text-area, perhaps composing a news article, one
can in Windows copy'n'paste the lot to Notepad and save on disc.

If the server collaborated, one could send it a part-text to be kept and
returned on request, with a different button to send completed work.

Etc.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #6
<lk******@geocities.com> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.com...
Personally, I'm tired of losing my work because some web browser has
crashed. I do a lot of my best writing in the textarea box of some
form. I hate losing work and yet it happens often. Some of the best
weblog posts I've ever written ceased to exist because the web browser
I was using crashed. Some of the best love letters I've ever written
never reached their audience because of the damned browser. For a lot
of people, web browsers have replaced word processors as the place
where they do most of their writing. Yet you can not save your work
when you are in a web browser. It is painful to spend an hour on a
letter and then the browser crashes and you lose all your work.

But the browsers are not the only source of trouble when it comes to
writing online. Most email companies will end your session without
warning and without saving your work. If you spend an hour writing a
love letter in Hotmail and then hit "Send", Hotmail will wipe out your
work and take you back to the login screen.

Me and some friends have been working on a content management system,
and we hope to mitigate these problems. Ultimately, it is a problem
that the browser vendors need to solve, but till that day we are using
common sense and javascript to offer what minor protections we can.
With our software, when your session ends you get taken back to the
login screen, just like in Hotmail, but everything you just posted is
shown on the screen, so you can copy it, log back in, and paste it into
a form. That's a minor protection we offer that I wish Hotmail and
Yahoo and Earthlink offered. Also, we have a "Save" button sitting
above our textarea boxes. The save button doesn't do anything more than
grab the text in the textarea and send it to a new window, but at least
you can then save that new window to your harddrive and get some of the
protection you might expect to get by saving often in a word processor.


If its such a problem then how about periodically (every minute or so)
having your script highlight the textarea and copy it to the clipboard (and
save it via FSO to a file if you want)?
Jul 23 '05 #7
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:vANtd.162977$5K2.51522@attbi_s03...

[snip]
If its such a problem then how about periodically (every minute or so)
having your script highlight the textarea and copy it to the clipboard (and save it via FSO to a file if you want)?


Or just manually highlight the text periodically (via Ctrl+A) and save it to
the clipboard (via Ctrl+C or Ctrl+Insert). Then, if your browser crashes,
just open up Notepad and press Ctrl+V (or Shift+Insert) to paste what you
last "saved".

I also look into why your browser crashes so frequently; it's not something
that happens to most of us.
Jul 23 '05 #8
McKirahan wrote:

(snip)
I also look into why your browser crashes so frequently; it's not something that happens to most of us.


My point as well. Although Internet Explorer dies on occasion - with
the familiar '...sorry for the inconvenience' lament - I can't recall
the last time a Mozilla/Gecko UA, Opera, Safari did. When it did, I
suspect it had something to do with Flash, or convoluted scripting, or
plugins.

Presumably your users don't expect any persistence when moving back &
forth between pages, so this 'crashing' occurs within your own page(s).
Why might that be?

Jul 23 '05 #9
Browser's crash often no matter the operating system or computer or
browser. Safari on OS X crashes and Netscape 7.1 on Linux crashes and
IE on Windows 95 or XP crashes. There is no escaping browser crashes.
For that matter, there is no escaping crashes in, say, Microsoft Word,
but with Word it is easier to save every few minutes.

>>>>>>>>>>>. Or just manually highlight the text periodically (via Ctrl+A) and save
it to
the clipboard (via Ctrl+C or Ctrl+Insert). Then, if your browser
crashes,
just open up Notepad and press Ctrl+V (or Shift+Insert) to paste what
you
last "saved".>>>>>>>>>>>


No good - often when a browser crashes it crashes the whole computer.
I've lost tons of work this way and so has every single person that I
know. Talk to any college kid, you'll find they are resigned to it -
that most software is bad and crashes often and data is lost is assumed
to be a fact of life.

Jul 23 '05 #10
>>>>>>>>>>>>
When it did, I
suspect it had something to do with Flash, or convoluted scripting, or
plugins.
>>>>>>>>
Um, your point? As far as I know, the web will always have Flash,
convoluted scripting, bad plugins, badly done Java, non-valid HTML,
server timeouts and lost internet connections. Writing code as if
someday all these problems will go away strikes me as unrealistic.

Flash, in particular, seems to crash certain browsers. I can't tell you
how many times I've been writing something, then decided I needed to
look up a fact, so I open a new browser window and go to Google to
research the fact, then click through to one of the sites that Google
brings up, only to have that new site crash the whole browser, because
of some damn stupid advertisement.

>>>>>>> Presumably your users don't expect any persistence when moving back &
forth between pages, so this 'crashing' occurs within your own page(s).
Why might that be?>>>>>>>>>>


I can try to keep my own pages free of Flash, convoluted scripting, and
plug-ins, but I doubt that my users will only be using my site when
they are working. I don't know many people who do much serious work on
the web while keeping just one window open.

Jul 23 '05 #11
>>>>>>>>>>
When filling in a large text-area, perhaps composing a news article,
one
can in Windows copy'n'paste the lot to Notepad and save on disc.

If the server collaborated, one could send it a part-text to be kept
and
returned on request, with a different button to send completed work.
>>>>>>


That's what I do personally but what I need to do now is automate
something like that for my end users. What you describe is too complex
so I'm looking for ways to simplify.

Jul 23 '05 #12
Isn't FSO limited to the Microsoft world? It's an ActiveX object, isn't
it? All our code is open-sourse PHP and Javascript, so ActiveX isn't an
option for us. Even if it was, I'd hate myself if I started telling
users "Just use IE for everything."

Jul 23 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
19270
by: Martin | last post by:
I have the following function in the onchange event of several text boxes. If the user enters an invalid number the alert displays. I would like to return the user to that same field after he...
1
1995
by: Andrew Poulos | last post by:
I've got some code then I call an alert and then some more code. On IE the second lot of code doesn't execute until the I click "ok" on the alert (which is what I want) but in MZ and FF the second...
2
2286
by: Robert Nurse | last post by:
Hi All, I've got a strange problem in IE that I wonder if anyone has seen before. Basically, I've got a two window scenario. The parent window opens the child via window.open(). The child...
3
4474
by: Dica | last post by:
this works: document.all.style.visibility = 'hidden'; this doesn't setTimeout("document.all.style.visibility = 'hidden'",1000); looks like sResponseDivID isn't recognized. what's the problem?...
7
8801
by: Phin | last post by:
Hi, I am tring to update some text in a div statement via document.getElementById("test").innerHTML = "data loaded!" and <div id="test"> Loading ... please hold!
14
2809
by: Nick K. | last post by:
I am looking for architecture to push information from a server to a client browser. This information would be in the form of an alert. What I do not want to do is have the browser be on a timer...
1
1691
by: Joris Lambrecht | last post by:
Hi people, Please take a look at the issue i talk about below. (yes i do realise such functions are publicaly available) The page i'm using uses JSON defined array of image files with...
4
1929
by: Z1P2 | last post by:
I have this alert that works: <script type="text/javascript"> var monitor = setTimeout("alert('The monitor is working!');",0); </script> </head> But I want to turn the alert message into a...
8
2491
by: knkk | last post by:
Instead of an id getting its innerHTML changed, the entire page is getting refreshed with this function of mine (you may want to look just at the end of the function where there's an alert): ...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.