[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

How to make a dynamic category bold when selected

WIN XP PRO
DWMX
Classic ASP VBScript
MS Access

Hello.  I have a simple page with dynamic category links on the left side.  When one is clicked, its respective main image appears in the center of the page with "Next" and "Previous" links below to page through the recordset.

I would like to have the category that is selected to become bold.  How could I do this?
I don't know if it would be ASP or Javascript or both.

Here's the link for reference:  <http://www.whitneywood.com/work.asp>

Just click a Category link on the left.  Whichever you click, I would like it to become bold.

Thank you so much,
Shane
0
lshane
Asked:
lshane
  • 3
  • 2
2 Solutions
 
Mass Dot NetCommented:
Can you provide some of the code you use to create / generate the Category links on the left?
0
 
lshaneAuthor Commented:
Hi, deathtospam.  You bet.  It's just a standard DWMX recordset.  I'll attach it.  I'll also attach the section to display the categories.

Thanks so much!
======================================================================
Categories DWMX recordset
======================================================================
<%
Dim rsCategories
Dim rsCategories_numRows
 
Set rsCategories = Server.CreateObject("ADODB.Recordset")
rsCategories.ActiveConnection = MM_connwhitney_STRING
rsCategories.Source = "SELECT * FROM categories"
rsCategories.CursorType = 0
rsCategories.CursorLocation = 2
rsCategories.LockType = 1
rsCategories.Open()
 
rsCategories_numRows = 0
%>
 
======================================================================
Code to display the dynamic data on the left
======================================================================
<td width="240"><a href="work.asp?catID=<%=(rsCategories.Fields.Item("catID").Value)%>"><%=(rsCategories.Fields.Item("catName").Value)%></a></td>

Open in new window

0
 
Mass Dot NetCommented:
Give this a shot and let me know if it makes sense / work.
======================================================================
Add this code above the Categories DWMX recordset area:
======================================================================
<%
iSelectedCatID = 0
If IsNumeric(Request("catID")) Then
	iSelectedCatID = CLng(Request("catID"))
End If
%>
 
======================================================================
Revise your code to display the dynamic data on the left like this:
======================================================================
<%
iCatID = CLng(rsCategories.Fields.Item("catID").Value)
sCategoryNameHTML = rsCategories.Fields.Item("catName").Value
 
If (iCatID = iSelectedCatID) Then
	sCategoryNameHTML = "<b>" & sCategoryNameHTML & "</b>"
End If
%>
<td width="240"><a href="work.asp?catID=<%=iCatID%>"><%=sCategoryNameHTML%></a></td>

Open in new window

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
hieloCommented:
Update the following line:
<td width="240"><a href="work.asp?catID=<%=(rsCategories.Fields.Item("catID").Value)%>"><%=(rsCategories.Fields.Item("catName").Value)%></a></td>

 so that it looks like the attached code
<%
Dim id
id = CInt( Request("catID") )
If id = rsCategories.Fields.Item("catID").Value Then
%>
	<td width="240"><a href="work.asp?catID=<%=(rsCategories.Fields.Item("catID").Value)%>"><strong><%=(rsCategories.Fields.Item("catName").Value)%></strong></a></td> 
<%
Else
%>
	<td width="240"><a href="work.asp?catID=<%=(rsCategories.Fields.Item("catID").Value)%>"><%=(rsCategories.Fields.Item("catName").Value)%></a></td> 
<%
End If
%>

Open in new window

0
 
lshaneAuthor Commented:
Thank you deathtospam and hielo.  Both solutions worked and I will be able to use both on other pages.

I will split the points.


Thanks so much,
Shane

0
 
lshaneAuthor Commented:
Thank you so much!
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now