Solved

Header links problem???

Posted on 2007-04-11
9
127 Views
Last Modified: 2010-04-25
I have a header with a nav bar in it. It has links which are images that swap according to which page yo uare on.

The problem is that when i click o the links, it goes to the page but doesnt reflect the current swap image.

Is this because you cannot  do this in a header include??????

0
Comment
Question by:judsonmusic
[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
  • 5
  • 4
9 Comments
 
LVL 3

Author Comment

by:judsonmusic
ID: 18889851
Apparently the header is refreshing everytime a page loads. Is there a way to check the current page and display the appropriate link accordingly???

Thanks
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18889959
it may be caching... you could force a reload

<cfheader name="Expires" value="#GetHttpTimeString(Now())#">
0
 
LVL 3

Author Comment

by:judsonmusic
ID: 18890013
I dont get it.
0
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
LVL 3

Author Comment

by:judsonmusic
ID: 18890036
I have the images(links) set to show a "HOT" version on the curent page. The problem is that because the navbar is and include, it doesnt see the current page. Is there a way around this without using frames?


Thanks

Judson
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18891235
"navbar is an include, it doesnt see the current page"

that doesn't make sense... if it is an include it -is- part of the "current page" only in a frame would the "header" be different from the body

please post some code showing how you are setting the image state
0
 
LVL 3

Author Comment

by:judsonmusic
ID: 18891327
HERE IS THE CODE BELOW. WHAT WOULD BE THE MOST EFFECIENT WAY TO USE THIS SO IF A PAGE USES A CFLOCATION to go back, it would reflect the current page location and show the current state of the correct button?????


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
-->
</style>
<script language="JavaScript" type="text/javascript">
function showdrop()
{
var nstyle= 'vis'
var thediv = 'SUB1'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function nodrop()
{
var nstyle= 'novis'
var thediv = 'SUB1'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function showdrop2()
{
var nstyle= 'vis'
var thediv = 'SUB2'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function nodrop2()
{
var nstyle= 'novis'
var thediv = 'SUB2'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function showdrop3()
{
var nstyle= 'vis'
var thediv = 'SUB3'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function nodrop3()
{
var nstyle= 'novis'
var thediv = 'SUB3'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function showdrop4()
{
var nstyle= 'vis'
var thediv = 'SUB4'
identity=document.getElementById(thediv);
identity.className=nstyle;
}
function nodrop4()
{
var nstyle= 'novis'
var thediv = 'SUB4'
identity=document.getElementById(thediv);
identity.className=nstyle;
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//-->
</script>
<link href="../CSS/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
      color: #FFFFFF;
      text-decoration: none;
}
a:visited {
      color: #FFFFFF;
      text-decoration: none;
}
a:hover {
      color: #CCCCCC;
      text-decoration: none;
}
a:active {
      color: #FFFF66;
      text-decoration: none;
}
-->
</style></head>

<body onload="MM_preloadImages('../../images/btn_dash_cold.gif','../../images/btn_DESKTOP_cold.gif','../../images/btn_desktop_over.gif','../../images/btn_desktop_HOT.gif','../../images/btn_MS_HOT.gif','../../images/btn_MS_over.gif','../../images/btn_DASHBOARDr_HOT.gif','../../images/btn_DASH_over.gif','../../images/btn_resources_HOT.gif','../../images/btn_RESOURCES_over.gif')">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td valign="top" background="../../images/BANNER_SPACER.gif"><img src="../../images/BANNER_HG_LOGO.gif" width="508" height="72" /><br />
      <a href="desktop.cfm" target="mainFrame" onclick="MM_nbGroup('down','group1','btnDESKTOPcold','../../images/btn_desktop_HOT.gif',1);showdrop(); nodrop2(); nodrop3(); nodrop4()" onmouseover="MM_nbGroup('over','btnDESKTOPcold','../../images/btn_desktop_over.gif','../../images/btn_desktop_HOT.gif',1)" onmouseout="MM_nbGroup('out')"><img src="../../images/btn_desktop_HOT.gif" name="btnDESKTOPcold" border="0" onload="MM_nbGroup('init','group1','btnDESKTOPcold','../../images/btn_DESKTOP_cold.gif',1)" /></a><a href="Members.cfm" target="mainFrame" onclick="MM_nbGroup('down','group1','btnMScold','../../images/btn_MS_HOT.gif',1);showdrop2(); nodrop(); nodrop3(); nodrop4()" onmouseover="MM_nbGroup('over','btnMScold','../../images/btn_MS_over.gif','../../images/btn_MS_HOT.gif',1)" onmouseout="MM_nbGroup('out')"><img src="../../images/btn_MS_cold.gif" name="btnMScold" border="0" /></a><a href="profile_frames.cfm?membno=<cfoutput>#session.membno#</cfoutput>" target="mainFrame" onclick="MM_nbGroup('down','group1','btnDASHBOARDrcold','../../images/btn_DASHBOARDr_HOT.gif',1);showdrop3(); nodrop(); nodrop2(); nodrop4()" onmouseover="MM_nbGroup('over','btnDASHBOARDrcold','../../images/btn_DASH_over.gif','../../images/btn_DASHBOARDr_HOT.gif',1)" onmouseout="MM_nbGroup('out')"><img src="../../images/btn_DASHBOARDr_cold.gif" name="btnDASHBOARDrcold" width="101" height="23" border="0" /></a><a href="resources.cfm" target="mainFrame" onclick="MM_nbGroup('down','group1','btnresourcescold','../../images/btn_resources_HOT.gif',1);MM_nbGroup('down','group1','btnresourcescold','../../images/btn_resources_HOT.gif',1);MM_nbGroup('down','group1','btnresourcescold','../../images/btn_resources_HOT.gif',1);showdrop4(); nodrop2(); nodrop3(); nodrop()" onmouseover="MM_nbGroup('over','btnresourcescold','../../images/btn_RESOURCES_over.gif','../../images/btn_resources_HOT.gif',1)" onmouseout="MM_nbGroup('out')"><img src="../../images/btn_resources_cold.gif" name="btnresourcescold" width="207" height="23" border="0" /></a></td>
    <td width="100%" align="right" valign="top" nowrap="nowrap" background="../../images/BANNER_SPACER.gif"><img src="../../images/BANNER_BP_METER_links_r1_c3.gif" width="357" height="95" /></td>
  </tr>
  <tr>
    <td height="22" valign="middle" background="../../images/sublinks_BG.gif">
      
            <div id="SUB1" class="vis"><!--<a href="#">SUBLINK1</a>&nbsp;|&nbsp;<a href="#">SUBLINK1</a>&nbsp;|&nbsp;<a href="#">SUBLINK1</a>&nbsp;|&nbsp;<a href="#">SUBLINK1</a>&nbsp;|&nbsp;<a href="#">SUBLINK1</a>&nbsp;|&nbsp;<a href="#">SUBLINK1</a> --></div>
            
              <div id="SUB2" class="novis"><!--<a href="#">SUBLINK2</a>&nbsp;|&nbsp;<a href="#">SUBLINK2</a>&nbsp;|&nbsp;<a href="#">SUBLINK2</a>&nbsp;|&nbsp;<a href="#">SUBLINK2</a>&nbsp;|&nbsp;<a href="#">SUBLINK2</a>&nbsp;|&nbsp;<a href="#">SUBLINK2</a> --></div>
            
            <div id="SUB3" class="novis"><a href="#">Encounters</a>&nbsp;|&nbsp;<a href="#">Claims</a>&nbsp;|&nbsp;<a href="#">Prescriptions</a>&nbsp;|&nbsp;<a href="#">Screenings</a></div>
            
            <div id="SUB4" class="novis"><!--<a href="#">SUBLINK1</a>&nbsp;|&nbsp;<a href="#">SUBLINK4</a>&nbsp;|&nbsp;<a href="#">SUBLINK4</a>&nbsp;|&nbsp;<a href="#">SUBLINK4</a>&nbsp;|&nbsp;<a href="#">SUBLINK4</a>&nbsp;|&nbsp;<a href="#">SUBLINK4</a> --></div>
            
            </td>
    <td height="22" align="right" valign="top" nowrap="nowrap" background="../../images/sublinks_BG.gif"><!--DWLayoutEmptyCell-->&nbsp;</td>
  </tr>
</table>
</body>
</html>
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18891544
man I hate dreamweaver code...

i don't actually see any logic which is looking to see if someone has logged in or not


basically (without trying to decipher that dw mess) the concept is as follows

on any page where you want to check logged in state you would set a local variable and then set up up cfif or cfswitch logic and place display code in each

on your login form you'd add

<cfif login eq OK> (or however you determine a good login)
<cflock type="exclusive" scope="session" timeout="30">
<cfset session.LogState eq true>
</cflock>

<cflocation...wherever>

then your header code would contain

<cfparam name="vLogState" default ="false">
<!--- set variable state for none logged in  --->

<cflock type="readonly" scope="session" timeout="30">
<cfset vLogState = session.LogState>
<!--- session.logstate is set on your login processing page --->
</cflock>


<cfif vLogState eq true>
your logged-in navbar code and images
<cfelse>
Your public code and images
</cfif>
0
 
LVL 3

Author Comment

by:judsonmusic
ID: 18891683
Actually, to make this easier, how can i make the current page effect which image diplays in the navbar???
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 18892021
this code does that...

<cfif vLogState eq true>
your logged-in navbar code and images
<cfelse>
Your public code and images
</cfif>

there's probably some js stuff you could use as well but you'd still need to evaluate some kind of cf variable passed from the login page so really there's no need...just makes things more complicated.

0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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