I am running a query and am try to output the information using cfoutput like this:
<cfoutput query="the_query">
<p><a href="#">#QueryResult#</a><p>
</cfoutput>
Coldfusion won't allow开发者_开发问答 me to uses the # in href. It says "Invalid CFML construct", but I need it to be href="#". Is there a way to escape this?
Just double up on the # character. ## inside a tag will output a single #.
<cfoutput query="the_query">
<p><a href="##">#QueryResult#</a><p>
</cfoutput>
No problem putting these up against regular terms, either, say you wanted to name the anchor using a field from the query:
<p><a href="###QueryResultField#">#QueryResult#</a><p>
This would give you
<p><a href="#myAnchorName">Result Here</a><p>
精彩评论