window.status Javascript

S

Steve

hey guys,

i have been searching around... and it seems that the below code is
good for a SINGLE PAGE.

<BODY BGCOLOR=white onMouseOver="window.status=' something ';return
true">


but... i have TONS of pages, and instead of going to each page and
adding this code, i was wondering if the above code could be done in a
javascript that i can put in my HEAD... such as <SCRIPT> ....</SCRIPT>

in my hundreds of pages, I have them pointing to one page that has a
list of scripts.... and would like to add that script here.
 
F

Fabian

Steve hu kiteb:
hey guys,

i have been searching around... and it seems that the below code is
good for a SINGLE PAGE.

<BODY BGCOLOR=white onMouseOver="window.status=' something ';return
true">


but... i have TONS of pages, and instead of going to each page and
adding this code, i was wondering if the above code could be done in a
javascript that i can put in my HEAD... such as <SCRIPT> ....</SCRIPT>

in my hundreds of pages, I have them pointing to one page that has a
list of scripts.... and would like to add that script here.

This kind of thing can be done in javascript, but would be done far more
efficiently in a style sheet.
 
E

Evertjan.

Steve wrote on 15 nov 2003 in comp.lang.javascript:
i have been searching around... and it seems that the below code is
good for a SINGLE PAGE.

<BODY BGCOLOR=white onMouseOver="window.status=' something ';return
true">

The return true has no purpose, methinks.
but... i have TONS of pages, and instead of going to each page and
adding this code, i was wondering if the above code could be done in a
javascript that i can put in my HEAD... such as <SCRIPT> ....</SCRIPT>

While you can do this:

<SCRIPT>
document.body.onclick=function(){window.status='something'}
</SCRIPT>

you have to write it AFTER the <body> declaration.

=============================

why not simply do this in the header:

<SCRIPT>
window.status='something else'
</SCRIPT>
 
M

Michael Winter

Evertjan. said:
Steve wrote on 15 nov 2003 in comp.lang.javascript:


The return true has no purpose, methinks.


While you can do this:

<SCRIPT>
document.body.onclick=function(){window.status='something'}
</SCRIPT>

you have to write it AFTER the <body> declaration.

=============================

why not simply do this in the header:

<SCRIPT>
window.status='something else'
</SCRIPT>
 
M

Michael Winter

[Apologies for my previous, pointless post]

on 15/11/2003:
Steve wrote on 15 nov 2003 in comp.lang.javascript:


The return true has no purpose, methinks.

Although this might be out-of-date, it is worth noting for
compatibility's sake. From Netscape's "Client-Side JavaScript
Reference", version 1.3 (1999):

"You can set the status property at any time. You must return true if
you want to set the status property in the onMouseOver event handler."
Description of the window.status property.

Mike
 
E

Evertjan.

Michael Winter wrote on 15 nov 2003 in comp.lang.javascript:
"You can set the status property at any time. You must return true if
you want to set the status property in the onMouseOver event handler."
Description of the window.status property.

This would in practice only be important if you
do a <a onmouseover=...
because a false return disables the href executuion
(even then at least IE defaults to true)
 
S

Steve

<SCRIPT>
window.status='something else'
</SCRIPT>

the above script does not work...
if there is no javascript that does this... can anyone tell me how to
do it in css sheet?

steve
 
L

Lasse Reichstein Nielsen

<SCRIPT>
window.status='something else'
</SCRIPT>

the above script does not work...

It does for me.
That is, you have not given sufficient information for us to do anything
about your problem.

These all work for me:

---
<script type="text/javascript">
window.status="foo";
</script>
<img src="../../PicA.png"
onmouseover="window.status='bar';return true;"
onmouseout="window.status='';return true;">
<input type="button" value="set baz!" onclick="window.status='baz';">
---

Tested in IE6, Moz FB and Opera 7.
if there is no javascript that does this... can anyone tell me how to
do it in css sheet?

It can't be done with CSS.

/L
 
S

Steve

okay...

as stated earlier.. i have about 300 pages. all pages go to this ONE
page where i just list all my javascripts (so i only need to modify
one page). this one page is has no body, no text, just a collection of
script i use throughout the whole site.

rather than going to each page and adding a script in the body or the
link, i want a <SCRIPT> that i can just add in my ONE page. this
means that this script can not use <BODY> tags... or <IMAGE> tags...
just a script in my one page to make it so no one can view the urls of
my files.

does this help? and is this possible?
 
L

Lasse Reichstein Nielsen

as stated earlier.. i have about 300 pages. all pages go to this ONE
page where i just list all my javascripts (so i only need to modify
one page). this one page is has no body, no text, just a collection of
script i use throughout the whole site.

So, you include a big JS-*file* in all your pages, and you do so in
the head element. It is not a page, just a file (I hope :).

Do the pages have a body.onload handler? If you want to centralize the
code, it would be smart if all 300 pages had
<body onload="init()">
and then the init function would set up the things that can't be handled
while the page is still being loaded.
rather than going to each page and adding a script in the body or the
link, i want a <SCRIPT> that i can just add in my ONE page. this
means that this script can not use <BODY> tags... or <IMAGE> tags...

This sucks, and there isn't a lot you can do about it. If your code
must run while the head element is being loaded, then it can't access
the body element. In order for it to run later, you must provide some
sort of hook.
just a script in my one page to make it so no one can view the urls of
my files.

Why on earth do you think you need that. The URL is still there, and there
are lots of ways to find it. However, hiding it from the statusbar has only
one use: To annoy the users (and will fail in some browsers, no matter what
you do).
does this help? and is this possible?

Yes. Probably not. You can use setTimeout to delay execution of some
code until the body element is perhaps loaded. Or even use setInterval
to keep trying until it is. But it will never be pretty.

/L
 
T

Thomas 'PointedEars' Lahn

Fabian said:
Steve hu kiteb:

This kind of thing can be done in javascript, but would be done far more
efficiently in a style sheet.

Unlikely. It is the status bar the OP wants to manipulate and
I have never heard of a (proprietary) CSS property that does that.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Steve said:
<BODY BGCOLOR=white onMouseOver="window.status=' something ';return
true">


but... i have TONS of pages, and instead of going to each page and
adding this code, i was wondering if the above code could be done in a
javascript that i can put in my HEAD... such as <SCRIPT> ....</SCRIPT>

in my hundreds of pages, I have them pointing to one page that has a
list of scripts.... and would like to add that script here.

The issue of including a script library containing the code aside,
you want to leave the status bar as is because it is *my* status
bar, a useful tool, and not your playground nor that of any other
scriptkiddie. Recent UAs have means to block JavaScript access to
the status bar, too.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top