Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on <a href>

Status
Not open for further replies.

ivalum21

MIS
Jul 14, 2004
63
US
This is what I got so far. I'm looping my category names into a table and trying to link them to sections on the same page below the table of categories.

What am I doing wrong?

Code:
<cfoutput>

<cfset I = 1>
<cfset columns = 3>

<table align="center" cellspacing="5" cellpadding="5" border="0">

<cfloop query="GetCat">
<cfif i MOD columns EQ 1>
  <tr>
</cfif>
<td><a href="Section1?catID=#FAQCatID#">#GetCat.FAQCategoryName#</a></td>
<cfif i MOD columns EQ 0>
  </tr>
</cfif>
<cfset i = i + 1>
</cfloop>

<cfif i MOD columns NEQ 1>
  </tr>
</cfif>
</cfoutput>
</table>

<a name="Section1">This is section 1!!</a>
 
Section1?catID=#FAQCatID#

it looks like you are trying to pass a variable to another section of the page. I don't think you can pass variables to anchors, and the href would need to look like (as Teknology said)

<a href="#Section1">click to go to section 1</a>


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
Whenever I do that, I get an error saying "Invalid construct"...it thinks I need another # or something.
 
yeah you probably need to make it 2 #'s


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
please post your new code, i'll have a look


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
Code:
<!--- Loop Categories into Table --->
<cfoutput>

<cfset I = 1>
<cfset columns = 3>

<table align="center" cellspacing="5" cellpadding="5" border="0">

<cfloop query="GetCat">
	<cfif i MOD columns EQ 1>
		<tr>
	</cfif>
	<td><a href="#Section1">#GetCat.FAQCategoryName#</a></td>
	<cfif i MOD columns EQ 0>
		</tr>
	</cfif>
	<cfset i = i + 1>
</cfloop>

<cfif i MOD columns NEQ 1>
 	</tr>
</cfif>

</cfoutput>
</table>

<a name="Section1">This is section 1!!</a>
 
this doesn't work for you?
Code:
<td><a href="##Section1">#GetCat.FAQCategoryName#</a></td>

i rarely use anchors this way, but i think this should work for you.


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
That works...thank you very much.

Just wondering, you said that isn't the way you use anchors, how do you use them?
 
well i just meant i have never output anchors dynamically- i don't see anything wrong with how you're doing it


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top