[英]using a coldfusion variable in a javascript function name
I have a function in a .cfm
template that gets called multiple times in another page. 我在.cfm
模板中有一个函数,该函数在另一个页面中多次调用。 The problem is, I need the functions name to be dynamic. 问题是,我需要函数名称是动态的。 Is there a way to concatenate a ColdFusion variable with a javascript function name? 有没有办法用JavaScript函数名称连接ColdFusion变量? Like so: 像这样:
CFML: CFML:
<cfset id = "">
JS: JS:
function name#id# ()
You can do this: 你可以这样做:
<script type="text/javascript">
<cfoutput>
function name#id#()
</cfoutput>
</script>
But it is more likely that you want to do this: 但是您更可能想这样做:
<script type="text/javascript">
<cfoutput>
name(#id#)
</cfoutput>
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.