Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: page title


Message #1 by KATHLEEN.M.WHALEN@c... on Fri, 17 Aug 2001 08:25:57 -0400
I have a script that changes the Page Title of my document based on the
navigation button chosen.  The page is setup in frames.  The page/scripts
are setup so that when the home page is displayed, the heading is blank
("blank.gif").   Then when I click on a navigation button, such as OAC,
the page title (and graphic) change to OAC.gif.  This all works very
smoothly.  However, I notice that if I'm on the OAC page (or any page
other than HOME) and I hit Refresh (F5), the page title returns to Blank
("Blank.gif").  How can I set this up so that the appropriate gif will
appear until the "return to home" button is used?

I am working in IE5.1 only.


I have the following function in the <head> section of my page.
<script language="javascript">
        function imUpdate(item){
                document.all[currSel].style.visibility = "hidden";
                document.all[item.value].style.visibility = "visible";

                currSel = item.value;
        }
</script>

--------------------
the page title area is set up as follows:
    <td>
      <DIV ALIGN="CENTER"><img src="../OI/IMAGES/TITLE.GIF" alt="Office of
Investigations"></DIV>
          <DIV CLASS="imPos" id="Blank" align="center"><img
src="../OI/Images/Titles/Blank.gif" alt=" "></div>
          <DIV CLASS="imPos" id="OAC" align="center"><img
src="../OI/Images/Titles/OAC.gif" alt="Office of Assistant
Commissioner"></div>
          <DIV CLASS="imPos" id="Domestic" align="center"><img
src="../OI/Images/Titles/Domestic.gif" alt="Domestic Operations"></div>
          <DIV CLASS="imPos" id="Field" align="center"><img
src="../OI/Images/Titles/FieldOffices.gif" alt="Field Operations"></div>
          <DIV CLASS="imPos" id="Investigative" align="center"><img
src="../OI/Images/Titles/Investigative.gif" alt="Investigative
Programs"></div>
          <DIV CLASS="imPos" id="Admin" align="center"><img
src="../OI/Images/Titles/Administration.gif" alt="Administration Planning
& Policy"></div>
          <DIV CLASS="imPos" id="Air&Marine" align="center"><img
src="../OI/Images/Titles/Air&Marine.gif" alt="Air & Marine
Interdiction"></div>
          <DIV CLASS="imPos" id="Intelligence" align="center"><img
src="../OI/Images/Titles/Intelligence.gif" alt="Intelligence
Division"></div>
          <DIV CLASS="imPos" id="Tactical" align="center"><img
src="../OI/Images/Titles/Tactical.gif" alt="Tactical
Communications"></div>
    </TD>

--------------
The corresponding script that goes with the navigation buttons is as
follows:
<TR>
        <TD valign="top"> <a href=../OI/Construction.asp target="body"
 onMouseOver="rollOver('btn1','../OI/Images/Buttons/OAC_f2.gif');"
 onMouseOut="rollOver('btn1','../OI/Images/Buttons/OAC.gif');"
                        onClick="imUpdate(this);"
                        value="OAC"> <img
src="../OI/Images/Buttons/OAC.gif" alt="Office of Assistant Commissioner"
name="btn1" border="0" width="104" height="36"></a></TD>
</TR>
---------------
At the very bottom just before </body> is the following:
I know it's this script that's setting me back to "blank.gif" each time my
page is refreshed.  How do I work around this so that currSel equals the
item/button that was last chosen (home, oac, tactical, etc.)?

<script language="javascript">
        var currSel="Blank";
        document.all.Blank.style.visibility = "visible";
</script>


  Return to Index