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
Solved

Set link in header frame to active onload

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

790 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