Solved

Set link in header frame to active onload

Posted on 2002-05-22
5
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Find out what you should include to make the best professional email signature for your organization.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

630 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