Solved

Set link in header frame to active onload

Posted on 2002-05-22
5
289 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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 …

734 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