Solved

Set link in header frame to active onload

Posted on 2002-05-22
5
275 Views
Last Modified: 2008-10-13
I've got an application that's designed around some complex frames with menus in headers.  When the page loads, I'd like the menu item to switch to an active link since that's the page in the child frame.  The links are controlled by styles in an attached style sheet.  In the example below, I'd like the Matched Record link to be set to active onload.

<html>

<head>
<title>Application</title>
<base target="main">
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body topmargin="0" leftmargin="0">
  <table height="30" width="100%" class="hcell">
    <tr>
      <td class="htable">Record Management</td>
      <td valign="middle" width="125" align="center">
          <a href="matched/frame.htm" class="header">Matched Records</a>
      </td>
      <td valign="middle" width="125" align="center">
          <a href="questionable/frame.htm" class="header">Potential Matches</a>
      </td>
      <td valign="middle" width="125" align="center">
          <a href="orphaned/frame.htm" class="header">Orphaned Records</a>
      </td>
      <td valign="middle" width="125" align="center">
          <a href="notprocessed/frame.htm" class="header">Unprocessed Records</a>
      </td>
    </tr>
  </table>
</body>
</html>
0
Comment
Question by:sluggo050499
  • 2
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
ID: 7028972
Basically you re-set the class. Does not work in NS4.x

<script>
function document_onload()
{
   if(document.layers) return;
   document.links[0].className="activeclassname";
}
window.onload=document_onload;
</script>
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 7029416
Yep, the only way to make it cross-browser is to load a different page for the header frame that allready has the correct class set. That way Netscape can also handle it.

Cheers,
Max.
0
 

Author Comment

by:sluggo050499
ID: 7029613
It's going in an ASP app - IE only ;)

So there doesn't need to be an onload event in the body tag?  Or should the script be in the body tag rather than in the head tags?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7029628
The script already does that (window.onload=)
0
 

Author Comment

by:sluggo050499
ID: 7029677
It does set the link to active but doesn't utilize the class that I've set for that header in the style sheet:

a.header:link { color: #FFFFFF; font-size: 7pt; font-family: Microsoft Sans Serif;
               font-weight: bold }
a.header:visited    { color: #FFFFFF; font-size: 7pt; font-family: Microsoft Sans Serif;
               font-weight: bold }
a.header:active     { color: #000000; font-family: Microsoft Sans Serif; font-size: 7pt;
               font-weight: bold }
a.header:hover { color: #000080; font-size: 7pt; font-family: Microsoft Sans Serif;
                font-weight: bold }

Any ideas?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
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…

912 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

22 Experts available now in Live!

Get 1:1 Help Now