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

Rapid JS timer (setTimeout()) hides HTML hints

P: n/a
I need to fire a function 4 times a second using setTimeout()), but I
have an HTML-editor on the page (FCKeditor) which has hints over its
buttons. However, the rapid timer never allows these hints to appear.
Commenting out setTimeout() solves everything, hints come back.

How can I save these hints from disappearing (before even appearing)
when setTimeout fires?

Many thanks,
Keke

Sep 10 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

Lester wrote:
I need to fire a function 4 times a second using setTimeout()), but I
have an HTML-editor on the page (FCKeditor) which has hints over its
buttons. However, the rapid timer never allows these hints to appear.
Commenting out setTimeout() solves everything, hints come back.

How can I save these hints from disappearing (before even appearing)
when setTimeout fires?
Whithout an example of whatever it is that you are doing, the only help
you'll get are guesses.

It is possible that either you have a naming conflict or that your
repeated calls to setTimeout are hogging the one and only thread that
JavaScript has available to it, preventing anything else from
happening.

Post either a minimal example or a link to a page that displays the
behaviour. Quite often the process of making a minimal example will
make the cause apparent.
--
Rob

Sep 10 '06 #2

P: n/a
Okay. It's an ASP page.

<%
Dim oFCKeditor ' FOR FCKEDITOR, SEE www.fckeditor.net
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/Fforumeditor/"
oFCKeditor.Width = 513
oFCKeditor.Create "message"
%>

.....

<SCRIPT language="JavaScript">
<!--
var timeoutobject;
var oEditor;
var temporaryvalue = '';

function FCKeditor_OnComplete( editorInstance )
{
oEditor = editorInstance; //here we store the editor instance for
later use
timeoutobject = setTimeout("timing()",270);
}

function timing()
{
mymaxlength=2500;
t=oEditor.GetXHTML(true);

if (t.length mymaxlength) {
//message too long, warning + set revious state
if (t.length mymaxlength) {
oEditor.SetHTML(temporaryvalue);
alert('Message max length is ' + mymaxlength + ' characters.');
}

} else {
temporaryvalue = t; //set current message, we may need it later
document.frm.qwertyuiop.value = mymaxlength - t.length; //text field,
shows character count
}
timeoutobject = setTimeout("timing()",270);
}
//-->
</SCRIPT>

Sep 12 '06 #3

P: n/a
http://fidelio.hu/forumhozzaszolas.a...asp%3Fid%3D346

Here is a LIVE (!) page with the code above. Please be careful with
posting test example messagges there, because it is PUBLIC :-)

The editor buttons never show the hints, because of the timer. (They DO
have hints.)

Sep 12 '06 #4

P: n/a

Keke wrote:
http://fidelio.hu/forumhozzaszolas.a...asp%3Fid%3D346

Here is a LIVE (!) page with the code above. Please be careful with
posting test example messagges there, because it is PUBLIC :-)

The editor buttons never show the hints, because of the timer. (They DO
have hints.)
Get rid of setTimeout completely. The function seems to be called just
to count the remaining number of characters, why not use onkeypress or
onkeyup?

--
Rob

Sep 12 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.