Solved

Set link in header frame to active onload

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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 …

757 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