473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?

-----------------------------------------------------------------------
FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?
-----------------------------------------------------------------------

When changing the status in an event (e.g. onmouseover) you
should return true from the event. Also a number of browsers
require a short delay before setting the status to overcome their
default behaviour with the statusbar. «
onevent="setTimeout('window.status=\'Moomin\'',15) ;" »
Some browsers may be configured to disallow scripts from setting
the status.
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.

Sep 16 '06 #1
3 4172
"FAQ server" <ja********@dotinternet.bewrote in news:450c81f6$0$75035
$1*******@news.sunsite.dk:
When changing the status in an event (e.g. onmouseover) you
should return true from the event. Also a number of browsers
require a short delay before setting the status to overcome their
default behaviour with the statusbar. ®
onevent="setTimeout('window.status=\'Moomin\'',15) ;" ¯
Well, if "you should return true from the event" shouldn't the example show
that?
Sep 17 '06 #2
FAQ server wrote on 17 sep 2006 in comp.lang.javascript:
-----------------------------------------------------------------------
FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar
change?
-----------------------------------------------------------------------

When changing the status in an event (e.g. onmouseover) you
should return true from the event. Also a number of browsers
require a short delay before setting the status to overcome their
default behaviour with the statusbar. ®
onevent="setTimeout('window.status=\'Moomin\'',15) ;" ¯
Some browsers may be configured to disallow scripts from setting
the status.
Why not specify the different browser's behavour?

If we are at it why not incorporate the behavour of
window.title = "Moomin"
?

========

I could imagine building a browser that specificly disallows
the status bar to contain "Moomin".

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 17 '06 #3
VK

FAQ server wrote:
-----------------------------------------------------------------------
FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?
-----------------------------------------------------------------------

When changing the status in an event (e.g. onmouseover) you
should return true from the event.
>From the *event handler itself* and not from a function called by this
handler. The most often mistake was:

<html>
<head>
<title>window.status demo</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">

function setStatus(message) {
window.status = message;
return true;
}

</script>
</head>

<body>
<p>
<a href="noscript.html"
onMouseOver="setStatus('a JavaScript call');"
onMouseOut="setStatus(window.defaultStatus);"
onClick="window.alert('a JavaScript call'); return false;">Wrong
status set demo</a>
</p>
</body>
</html>

That seems that setStatus return true as requested yet status change
doesn't work. This is because out intrinsic handler is in fact an
anonymous function calling setStatus(), so we have:
function anonymous() {
setStatus('a JavaScript call');
}
and respectively we do not return any true from that anonymous
function. The proper way is:

<html>
<head>
<title>window.status demo</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">

function setStatus(message) {
window.status = message;
return true;
}

</script>
</head>

<body>
<p>
<a href="noscript.html"
onMouseOver="return setStatus('a JavaScript call');"
onMouseOut="return setStatus(window.defaultStatus);"
onClick="window.alert('a JavaScript call'); return false;">Right
status set demo</a>
</p>
</body>
</html>
Also a number of browsers
require a short delay before setting the status to overcome their
default behaviour with the statusbar.
onevent="setTimeout('window.status=\'Moomin\'',15) ;"
Besides it is not a working sample whatsoever (no true return value):
which browsers require such delay?
Some browsers may be configured to disallow scripts from setting
the status.
Full ACK, and more and more of them: as the status message change is
one of common annoyances and a potential security risk (links fraud).

Yet if we give a sample of use, let's make it at least properly working
(where allowed).

All possible usage methods (on UA's where not blocked):

<html>
<head>
<title>window.status demo</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function setStatus(message) {
window.status = message;
return true;
}

function init() {
var p = document.getElementById('p04');
p.onmouseover = function() {
window.status = 'a JavaScript call';
return true;
}
p.onmouseout = function() {
window.status = window.defaultStatus;
return true;
}
p.onclick = function() {
window.alert('a JavaScript call');
return false;
}
}

window.onload = init;
</script>
</head>

<body>
<p>
<a href="noscript.html"
onMouseOver="window.status = 'a JavaScript call'; return true;"
onMouseOut="window.status = window.defaultStatus; return true;"
onClick="window.alert('a JavaScript call'); return false;">Intrinsic
handler demo</a>
</p>

<p>
<a href="noscript.html"
onMouseOver="return setStatus('a JavaScript call');"
onMouseOut="return setStatus(window.defaultStatus);"
onClick="window.alert('a JavaScript call'); return false;">Function
call demo</a>
</p>

<p>
<a href="noscript.html"
onMouseOver="setStatus('a JavaScript call');"
onMouseOut="setStatus(window.defaultStatus);"
onClick="window.alert('a JavaScript call'); return false;">Wrong
function call demo</a>
</p>

<p id="p04">Programmatically attached handler demo</p>
</body>
</html>

Sep 17 '06 #4

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

Similar topics

0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.