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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble referencing anchors when pasing variables 2

Status
Not open for further replies.

leadman

Programmer
Joined
Jun 11, 2001
Messages
177
Location
US
Hi all,
Im adding some anchors to a target page like the following:

<A NAME=&quot;anchor1&quot;></a>

Then on the page that points to the page with the above anchor on it ive changed a working link that used to look like this:

<a href=&quot;pagewithanchor.cfm?strProdID=#strProdID#&quot;>

to this:

<a href=&quot;pagewithanchor#anchor1.cfm?strProdID=#strProdID#&quot;>

When I try to load the page with the link on it i get the following error on that line of code:

Just in time compilation error

Invalid token found on line 230 at position 49. ColdFusion was looking at the following text:

?
Invalid expression element. The usual cause of this error is a misspelling in the expression text.

Any ideas?
 
Any time you want a pound sign to be a pound sign in Cold Fusion, you need to escape it with another pound sign (if it's between cfoutput tags).

So, you need to use ## in order to get #.

John Hoarty
jhoarty@quickestore.com
 
okay - i tried the anchor with this

<a href=&quot;pagewithanchor##anchor1.cfm?strProdID=#strProdID#&quot;>

but still got this:


Just in time compilation error

Invalid token found on line 230 at position 49. ColdFusion was looking at the following text:

?
Invalid expression element. The usual cause of this error is a misspelling in the expression text.

 
when placing anchor target you should put the actual target AFTER the question mark and AFTER any data folowing it; e.g.:

<a href=&quot;pagewithanchor.cfm?strProdID=#strProdID###anchor1&quot;>

if you build real dinamic page and the &quot;anchor1&quot; becomes anchor2, anchor3, anchor4..., you should consider putting it into a variable; in that case you'll need another pair of # signs:

<a href=&quot;pagewithanchor.cfm?strProdID=#strProdID####anchor1#&quot;> Sylvano
dsylvano@hotmail.com

&quot;every and each day when I learn something new is a small victory...&quot;
 
great - thanks, that helped lots!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top