Solved

window.status in CSS?

Posted on 2006-07-15
5
686 Views
Last Modified: 2013-11-19
This is a far fetched question...

<a href="" class="cs">I am a link</a>

Is there a way to make every link with a class of "cs" on my page have a window.status of "click to view"?  Ideally it would be...

A.cs {
      window-status:'click to view';
}

That I know of this is not possible.  If not, what might be an alternative way of doing this without modifying the actual link tag?  I'm thinking JavaScript after the page loads to loop through the page, grab all elements that are "cs", and then modify their properties from that...   ??   Any other ways maybe?
0
Comment
Question by:rebies
  • 3
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
DireOrbAnt earned 500 total points
Comment Utility
No, I don't believe you can do that.
An alternative would be using JavaScript with something like:
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
function SetStatusBar(ClassToSet, Msg) {
  var ToSet = document.getElementsByTagName('A');
  for(var i=0; i < ToSet.length; i++){
    if (ToSet[i].className && ToSet[i].className == ClassToSet) {
      ToSet[i].onmouseover = function() { window.status=Msg; return true; };
      ToSet[i].onmouseout = function() { window.status=''; };
    }
  }
}
</SCRIPT>
</HEAD>
<BODY onload="SetStatusBar('WStatus', 'click to view')">
<A HREF="javascript:;" CLASS="WStatus">Change Status</A><BR>
<A HREF="javascript:;">Don't change Status</A><BR>
<A HREF="javascript:;" CLASS="WStatus">Change Status Again</A><BR>
</BODY>
</HTML>
0
 
LVL 26

Expert Comment

by:DireOrbAnt
Comment Utility
Keep in mind that Firefox has an option to disable status bar changes through scripting and I believe it's disabled by default.
IE7 will do the same, I don't know what the default will be though.
0
 
LVL 1

Author Comment

by:rebies
Comment Utility
DireOrbAnt:

Sorry for the late reply!  Wow - thats really cool and what I was hoping to do!  Thanks.   I was doing it a similar, more difficult way...  I did not quite complete it, but in Psudo JS..

For All "A" elements
   element.outerHTML = element.outerHTML (with OnMouseOver="...") written in just before the first ">"

But the way you do it works much better!  Thus, I don't have to rewrite the HTML on the page at all!

Thanks for the hlep!
0
 
LVL 1

Author Comment

by:rebies
Comment Utility
By the way.  EE should have an "A++" feature - where they only encourage you to do that if the answer is amazingly perfect.  Looking at this - it's exactly what I was having difficulty with!  Thanks again for the help!  Now I don't have to re-write 1,000 random link tags!

Andrew
0
 
LVL 26

Expert Comment

by:DireOrbAnt
Comment Utility
>>EE should have an "A++" feature
I appreciate that and I'm happy you saved some time :)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now