开发者

Coldfusion Query Anchor Element by Id

开发者 https://www.devze.com 2023-02-28 23:01 出处:网络
I am running a query and am try to output the information using cfoutput like this: <cfoutput query=\"the_query\">

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消