Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Highlight Active Catagory
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Highlight Active Catagory

 Post Reply Post Reply
Author
Lucent View Drop Down
Groupie
Groupie


Joined: 06 June 2003
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lucent Quote  Post ReplyReply Direct Link To This Post Topic: Highlight Active Catagory
    Posted: 15 April 2005 at 7:27pm

This code is for catagory tree menu. For example.

Woman
    Handbag
    Top
    Pants
       
Man
    Belt
    Pants
    Suite
 
And whenever I'm in the catagory, the menu would stay open, and close other catagory.

My question is how can I modify this code so not only the active catagory would stay open, but it would also change the style of the catagory (background color, highlight the selected sub catagory, etc)
any help would be great, thank you!!

----------------code-------------------
<script>
 function UpDown(tabid)
 {
 var etab=eval(tabid);
  if (etab.style.display=='')
  { etab.style.display='none';
  }
  else
  { etab.style.display='';
  }
 }
</script>
<%
Dim CATsTmp(4)
Dim pcv_ToTalCAT
CATsTmp(0)=0
CATsTmp(1)=0
CATsTmp(2)=0
CATsTmp(3)=0
pcv_TotalCAT=0
dim conn, rsMenuObj
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open scDSN
if pcv_ShowAllCATs=1 then
 IF pcv_checkPageCat<>"" then
  HaveParent=1
  CATsTmp(0)=pcv_checkPageCat
  pcv_TotalCAT=1
  pcv_idcatTmp=pcv_checkPageCat
  do while HaveParent=1
   query="select idParentCategory from categories where idcategory=" & pcv_idcatTmp
   set rsMenuObj=server.CreateObject("ADODB.RecordSet")
   set rsMenuObj=conn.execute(query)
   
   if not rsMenuObj.eof then
    pcv_idcatTmp=rsMenuObj("idParentCategory")
    if pcv_idcatTmp="1" then
     HaveParent=0
    else
     pcv_TotalCAT=pcv_TotalCAT+1
     CATsTmp(pcv_TotalCAT-1)=pcv_idcatTmp
     HaveParent=1
    end if
   else
    HaveParent=0
   end if
  loop
  set rsMenuObj=nothing
 ELSE
  IF pcv_CheckPagePrd<>"" then
   query="select idcategory from categories_products where idproduct=" & pcv_CheckPagePrd
   set rsMenuObj=conn.execute(query)
   if not rsMenuObj.eof then
    HaveParent=1
    CATsTmp(0)=rsMenuObj("idcategory")
    pcv_TotalCAT=1
    pcv_idcatTmp=rsMenuObj("idcategory")
    do while HaveParent=1
     query="select idParentCategory from categories where idcategory=" & pcv_idcatTmp
     set rsMenuObj=server.CreateObject("ADODB.RecordSet")
     set rsMenuObj=conn.execute(query)
   
     if not rsMenuObj.eof then
      pcv_idcatTmp=rsMenuObj("idParentCategory")
      if pcv_idcatTmp="1" then
       HaveParent=0
      else
       pcv_TotalCAT=pcv_TotalCAT+1
       CATsTmp(pcv_TotalCAT-1)=pcv_idcatTmp
       HaveParent=1
      end if
     else
      HaveParent=0
     end if
     set rsMenuObj=nothing
    loop
   end if
  END IF
 END IF
end if

Function CheckCAT(catID)
 if pcv_TotalCAT>0 then
  For i=1 to pcv_TotalCAT
   if clng(catID)=clng(CATsTmp(i-1)) then
    CheckCAT=""
    exit for
   else
    CheckCAT=" style=""display:none"" "
   end if
  Next
 else
  CheckCAT=" style=""display:none"" "
 end if
End Function
%>
<%
If Session("customerType")=1 Then
 pcv_strTemp=""
else
 pcv_strTemp=" AND pccats_RetailHide<>1 "
end if
'----- Start Categories Level 1
query="select idcategory,categorydesc from categories where idParentCategory=1 and idCategory>1 and iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC"
set rsMenuObj=server.CreateObject("ADODB.RecordSet")
set rsMenuObj=conn.execute(query)
 
IF not rsMenuObj.eof then
 response.write "<table border=""0"" width=""100%"" cellpadding=""0"" cellspacing=""0"">" & vbcrlf
 do while not rsMenuObj.eof
  IDCategory1=rsMenuObj("idcategory")
  CatDesc1=rsMenuObj("categorydesc")
  
  '----- Start Categories Level 2
  query="select idcategory,categorydesc from categories where idParentCategory=" & IDCategory1 & " and idCategory>1 and iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC"
  set rsMenuObj2=server.CreateObject("ADODB.RecordSet")
  set rsMenuObj2=conn.execute(query)
 
  IF not rsMenuObj2.eof then
   response.write "<tr><td style=""padding-left: 8px;"" bgcolor=""#6A6A6A"" height=""25"" class=""boxframetopbottom1"">" & vbcrlf
   response.write "<strong><Font color=""#ffffff""><a href=""javascript:UpDown('SUB" & IDCategory1 & "')"" class=""HLlinkW"">" & CATDesc1 & "</a></font></strong></td></tr>" & vbcrlf
   response.write "<tr><td><table width=""100%""  cellspacing=""0"" cellpadding=""0"" " & CheckCat(IDCategory1) & " id=""SUB" & IDCategory1 & """ bgcolor=""#CCCCCC"" class=""boxframetopbottom"">" & vbcrlf
   do while not rsMenuObj2.eof
    IDCategory2=rsMenuObj2("idcategory")
    CatDesc2=rsMenuObj2("categorydesc")
  
    '----- Start Categories Level 3
    query="select idcategory,categorydesc from categories where idParentCategory=" & IDCategory2 & "  and idCategory>1 and iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC"
    set rsMenuObj3=server.CreateObject("ADODB.RecordSet")
    set rsMenuObj3=conn.execute(query)
 
    IF not rsMenuObj3.eof then
     response.write "<tr><td style=""padding-left: 16px;"" height=""20"" bgcolor=""#8F8F8F"">" & vbcrlf
     response.write "<a href=""javascript:UpDown('SUB" & IDCategory2 & "')"" class=""HLlink"">" & CATDesc2 & "</a></td></tr>" & vbcrlf
     response.write "<tr><td><table width=""100%"" cellpadding=""0"" cellspacing=""0"" " & CheckCat(IDCategory2) & " id=""SUB" & IDCategory2 & """>" & vbcrlf
     do while not rsMenuObj3.eof
      IDCategory3=rsMenuObj3("idcategory")
      CatDesc3=rsMenuObj3("categorydesc")
    &
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.