我在cf中有以下代码,我想提醒值
......
......
<cfelse>
<cfset val = structFind(request.session.prefs, key)>
<cfquery name="insertPref" datasource="database">
INSERT INTO
`database`.`user` (
`cID`,
`cliID`,
`userID`,
`userPID`,
`value`
)
SELECT
#request.cID#,
#request.cliID#,
#request.userID#,
`user`.`userPID`,
<cfqueryparam value="#preserveSingleQuotes(val)#">
FROM
`database`.`user`
WHERE
`applicationID` = 1
AND
`name` = <cfqueryparam value="#preserveSingleQuotes(key)#">
ON DUPLICATE KEY UPDATE
`value` = <cfqueryparam value="#preserveSingleQuotes(val)#">
</cfquery>
</cfif>
</cfif>
</cfloop>
任何帮助将不胜感激
答案 0 :(得分:3)
我会使用myval,因为val是一个返回整数的函数。
你有没有尝试过:
<cfoutput>
<script type="text/javascript">
alert("#myval#");
</script>
</cfoutput>
答案 1 :(得分:2)
如果您想将CF值转换为Javascript值,请使用ToScript。
<cfset thisString="hello world">
<script type="text/javascript" language="JavaScript">
<cfoutput>
var #toScript(thisString, "jsVar")#;
</cfoutput>
</script>