PRB: Moving Mouse Pointer Over Anchor Tag Shows Entire URL (185532)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Client SDK 4.0
  • Microsoft Internet Client SDK 4.01

This article was previously published under Q185532

SYMPTOMS

When you move the mouse pointer over an Anchor tag that has a Fragment Identifier in the URL, the entire URL is displayed in the status bar. In Internet Explorer 3.02, only the Fragment Identifier is displayed, not the entire URL.

RESOLUTION

To change URL information that is displayed in the status bar, use the window.status property. To do this, create a Web page, and paste one of the following code samples:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function showStatus(text)
{
window.setTimeout("window.status='" + text + "'", 1);
}
</SCRIPT>
</HEAD>
<BODY>
<A HREF="http://www.microsoft.com#somewhere">Link 1</A>
<A HREF="http://www.microsoft.com#somewhere"
  onmouseover="showStatus('#somewhere')"
  onmouseout="window.status=''">
Link 2</A>
</BODY>
</HTML>
				

-or-

<HTML>
<HEAD>
<SCRIPT>
function showStatus(text)
{
  window.event.returnValue = true;
  window.status = text;
}
</SCRIPT>
</HEAD>
<BODY>
<A HREF="http://www.microsoft.com#somewhere">Link 1</A>
<A HREF="http://www.microsoft.com" 
  onmouseover="showStatus('hello1');"
  onmouseout="showStatus('');">
Link 2</A>
</BODY>
</HTML>
				
When you move the mouse over the "Link1" text, the status bar shows the following URL:

http://example.microsoft.com#somewhere

When you move the mouse over the "Link2" text, the status bar shows the Fragment Identifier:

#somewhere

In Internet Explorer 4.0, you can set the status bar text directly in the onmouseover event as follows:
<A HREF="http://www.microsoft.com#somewhere"
  onmouseover="window.status='#somewhere'"
  onmouseout="window.status=''">
				
However, Internet Explorer 5.0 incorrectly overrides the text in status bar with the hyperlink, regardless of the value that is contained in the window.status property. You can set window.status after a short delay in setTimeout to work around this problem. When you set the window.event.returnValue to true, you ensure that the effect takes place and solves the problem.

REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

Modification Type:MajorLast Reviewed:5/11/2006
Keywords:kbprb KB185532