...

View Full Version : Status Bar Text



Schannah
02-26-2007, 04:48 AM
As much as I hate to use it, the design I am currently working on calls for one of those annoying marquees within the status bar. I'm understandably reluctant to use it, as I hate obscuring the link destinations and loading progress, and am trying to find a way to be able to enable the user to switch the status bar marquee on and off whenever they want, without having to refresh the page. At the moment, it isn't going well. I can include a code and a button to enable the user to start the status bar scroll:


<body>
<head>
<script language="JavaScript">
<!--
var count = 0;
var delay = 250;
var text = "This is what I am replacing the default status bar text with";
function scroll () {
window.status = text.substring (count, text.length) + text.substring (0, count)
if (count < text.length)
count ++;
else
count = 0;
setTimeout ("scroll()", delay);
}
-->
</script>
</head>
<form>
<input type="button" value="click here" onClick="scroll();">
</form>
</body>

Obviously, this doesn't enable the user to turn off the feature when he/she pleases; not only that, but (for some reason; my knowledge of Javascript doesn't cover enough for me to be able to come up with an explanation for this) the more the button is clicked, the faster the scroll becomes. I tried to include a button that set the window.status to window.statusDefault, but all that does is flash "undefined" in the status bar for a fraction of a second and carry on with the original script. Without the user refreshing the page, how can I include a code to stop the first code from executing?

I hope I've made the problem clear...

ikilledsanta
02-26-2007, 04:56 AM
As much as I hate to use it, the design I am currently working on calls for one of those annoying marquees within the status bar. I'm understandably reluctant to use it, as I hate obscuring the link destinations and loading progress, and am trying to find a way to be able to enable the user to switch the status bar marquee on and off whenever they want, without having to refresh the page. At the moment, it isn't going well. I can include a code and a button to enable the user to start the status bar scroll:


<body>
<head>
<script language="JavaScript">
<!--
var count = 0;
var delay = 250;
var text = "This is what I am replacing the default status bar text with";
function scroll () {
window.status = text.substring (count, text.length) + text.substring (0, count)
if (count < text.length)
count ++;
else
count = 0;
setTimeout ("scroll()", delay);
}
-->
</script>
</head>
<form>
<input type="button" value="click here" onClick="scroll();">
</form>
</body>

Obviously, this doesn't enable the user to turn off the feature when he/she pleases; not only that, but (for some reason; my knowledge of Javascript doesn't cover enough for me to be able to come up with an explanation for this) the more the button is clicked, the faster the scroll becomes. I tried to include a button that set the window.status to window.statusDefault, but all that does is flash "undefined" in the status bar for a fraction of a second and carry on with the original script. Without the user refreshing the page, how can I include a code to stop the first code from executing?

I hope I've made the problem clear...

Well, I'm not exactly great with JavaScript, but couldn't you just do this:

originalstatus=window.status;

before you start the marquee, and then incorporate some sort of check to see if you're running the marquee or you have it off, and to start the opposite function?

So basically have it do this:
1) Store status BEFORE the marquee with "originalstatus=window.status"
2) Check to see if marquee is on or off
3) If marquee is on, turn it off, and if it is off, turn it on


I know this is possible, and have seen it before on this site. I don't know how to do it without looking it up. Plenty of people on this forum know how to do it, hopefully one of them will stop by and help you.

By the way this belongs in the JavaScript section.

beeps
02-26-2007, 09:28 AM
Hi Schannah ,

Hope this will help you to solve your problem
----------------------

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
var count = 0;
var delay = 250;
var text = "This is what I am replacing the default status bar text with";
var gStatus="hide"
var gTime=0
function scroll () {
window.status = text.substring (count, text.length) + text.substring (0, count)
if (count < text.length){
count ++;
}
else{
count = 0;
}
//gTime = setTimeout ("scroll()", delay);
}
function fHideStatus(lObj){
lObj.outerHTML = '<input type="button" value="Show" onClick="fShowStatus(this);">'
count = 0;
window.status=""
clearInterval(gTime)

}
function fShowStatus(lObj){
gTime = setInterval("scroll()", delay);
lObj.outerHTML = '<input type="button" value="Hide" onClick="fHideStatus(this);">'
}
-->
</script>
</head>
<body>

</head>
<form>
<p><input type="button" value="Show" onClick="fShowStatus(this);"></p>
</form>
</body>
</html>

Schannah
02-26-2007, 05:40 PM
Ack. Slight problem: code doesn't work in Firefox. To be honest, it doesn't really need to work in Firefox as Firefox allows a link destination to be displayed on hover with or without other text in the status bar present; what would probably be better would be Firefox displaying the status bar text upon loading the page, and there being no button to tell it to do otherwise.

felgall
02-26-2007, 06:58 PM
Most modern browsers don't allow the web page to access the status bar for security reasons. The status bar displays information about the links on your page which phishing attempts wish to have concealed or replaced in order to make you think you're going to your bank's web site but instead you go to theirs where you enter your password and they empty your bank account.

eric6930
02-26-2007, 08:00 PM
You need to enable status bar writing in Firefox:

http://jdev.blogsome.com/2006/08/18/enable-window-status-in-firefox/

felgall
02-26-2007, 08:51 PM
You need to enable status bar writing in Firefox:

http://jdev.blogsome.com/2006/08/18/enable-window-status-in-firefox/


But only if you want the phishers to empty your bank account of all your money. It is turned off because having it on creates a big security hole for theives.

Schannah
02-27-2007, 12:16 AM
I'm not entirely sure what you mean. I know that Firefox doesn't generally change the status bar text when stated in a script on the page unless you go through to the Firefox settings and change the allowances. That's not what I mean, though. In Firefox, the button doesn't change to "Hide" after it's been clicked; it remains on "Show" and furthermore, when it's clicked again, it increases the speed of the marquee scroll. Owing to the fact that not many Firefox users will have gone through their settings and allowed the status bar text to be changed, I think the best course of action would be to include a script that detects the browser and, in the case of Firefox, doesn't show the button at all, so that's what I've done.

felgall
02-27-2007, 01:17 AM
Most other browsers don't allow the status bar to be updated either unless you change the settings. It is only IE that is still behind with their security settings that allows it by default.

Arty Effem
02-27-2007, 02:14 AM
As much as I hate to use it, the design I am currently working on calls for one of those annoying marquees within the status bar. I'm understandably reluctant to use it, as I hate obscuring the link destinations and loading progress, and am trying to find a way to be able to enable the user to switch the status bar marquee on and off whenever they want, without having to refresh the page. At the moment, it isn't going well. I can include a code and a button to enable the user to start the status bar scroll:
Someone asked for something similar recently. This script pauses when links are hovered (in the same frame) to allow the href to be shown, and it can be paused. Link (http://www.hotspot.freeserve.co.uk/scripterlative/?scrollstatus)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum