Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse over - mouse out to help with status bar script

Status
Not open for further replies.

Cresby

Programmer
Aug 15, 2002
287
GB
I have been using the Microsoft code to put custom reminder in the status bar and found one knowledgable user who uses the status bar for the default purpose of informing him where the hyperlink goes before clicking (there are presumably many more similar users)

Any ideas (instructions/commands)on using an "event model" type command with mouse over to then save hypelink URL and stop the current script and display the URL until "mouse out"?
 
Having read your post in the thread pertaining to blanking out the status bar (thread216-543675), I can possibly make a suggestion.

But first I need to clarify exactly what you're after...

What exactly does the script do? Does it simply display a message in the status bar, such as "Hello world!," as long as the user is holding the mouse over the link? Does it scroll a message and then stop with the full message in the status bar? Are you simply wanting to append the url to the end of the message that's displayed in the status bar?

Or is there a default script that's printing something to status bar that you want to interrupt when the user mousesover a link?

 
Yes there is a default script, it is a timer event driven scrolling message, it is still on cresby.com just now. The code is straight off the Microsoft Support site. The normal browser link URL is displayed, but it can only be seen as a flash before the timer code overides it in about 50 mS .
I have put a MouseOver / MouseOut in the <A HREF.....> and tried various things with the scrolling script but was not getting anywhere. The last resort was to have a 3 second timer invoking individual messages one after the other and the MouseOver event now sets a variable value so that &quot;if&quot; statements in the timer function prevent the timer from re-starting.
This is not what I intended but proof of method is established. The staus bar displays the series of messages until a mouseover when it displays the linked URL, until the mouseout which then allows the timer to have effect.

However, I was given advice (at a Folk festival so no fine detail) to look for &quot;event model&quot; type of directives that would declare (in my case) all links to invoke the MouseOver/Out events.

I guess I am looking for the line of code to do that. I have no problem declaring variables, but classes as a concept is escaping me.

TIA Cresby
 
Looks to me like all you need to do is this (I think one example will do):

<td VALIGN=CENTER COLSPAN=&quot;2&quot; BGCOLOR=&quot;#FBEDDB&quot;>
<a href=&quot;songs.htm&quot; target=&quot;_top&quot; onmouseover=&quot;StopTheClock()&quot; onmouseout=&quot;StartScrolling()&quot;>Cresby's songs</a></td>

I tested this by editing the code on your site and it should have the desired result. There is sometimes a little bit of delay when the scrolling is restarted, and I'm not really sure why.

In short, the solution is to, inside all of your anchor tags, include the following:
onmouseover=&quot;StopTheClock()&quot; onmouseout=&quot;StartScrolling()&quot;

Post again if there are any problems.
 
Thanks - thats the one I made work, but I was told there was an event model which would globalize it and I found code which cliams such. It clags in netscape 4.5 and does not enter the for loop in IE which maybe logical except that the code was offered as working. But I had to change the tag reference to 'A'

Code:
function StopTheClock(){
        clearTimeout(timerID)
		self.status = msgx +1;
  if (document.getElementsByTagName){
	var x = document.getElementsByTagName('A');
  	self.status = msgx +2;
  }
  else if (document.all) {
	var x = document.all.tags('A');
  	self.status = msgx +3;
  }
//  else return;
	self.status = msgx + x.length
  for (var i=0;i<x.length;i++) {
	x[i].onmouseover = changeover();
	x[i].onmouseout = changeback();
	self.status = msgx + 5
  }

}

I have tried looking at the status line when it changes due to a mouse over.
self.status or window.status holds only the loaded text not the link. If I knew what property holds the link I could compare with self.status and take action. Any ideas on this one? I am going to try self.href etc but I running blind.
 
Since var x is now the object containing the href, you should be able to get the url the anchor points to with x.href

Although self.href may work, too.

I'm interested to know what you find out.
 
Actually I typed too soon. Since getElementsByTag returns an array, it would be x[_i].href.
 
I tried my code and realised I had to have the HTML in place before it could look for Tags. Moved the code to after </BODY> but it now fails on x.anything (not tried href yet). Netscape (4.5) just has a java error and I can tell from the cludges I insert it is not liking the property

document.all.tags

If I can't get it right on Netscape it is a non-starter anyway. Function over form any day.
 
Actually IE5.5 responds to document.getElementsByTagName but then locks-out any kind of array!!!!! I am settling on NS4.5 and IE5.5 as my data. If it can't be done in them I give up on the method.

document.all doesn't do anything.

Thanks for your help. My quest is now to find the repository for the mouseover link text. I have Visual Studio and looked at various objects and found nothing that looked remotely promising.

Self. or window.href is not defined (ie wrong)

I will start a new thread/question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top