我有大约1天的学习时间,直到我需要能够使用Coldfusion(欢迎任何详细的教程)。
我在ColdFusion10 \ cfusion \ wwwroot中有2个文件(t1.cfm
和progress.cfc
)
<CFIF IsDefined("session.STATUS")>
<cfset StructDelete(Session, "Status") />
</CFIF>
<html>
<head>
<title>progressbar</title>
<script type="text/javascript">
function startprogress(barname){
ColdFusion.ProgressBar.show(barname);
ColdFusion.ProgressBar.start(barname);
}
function onFin(){
alert('Done');
}
</script>
</head>
<body>
<cfform>
<p>
<cfinput type="button" name="starter" value="start" onclick="startprogress('du')" />
<cfprogressbar name="du" duration="10000" interval="1000" width="200" oncomplete="onFin" />
</p>
<p>
<cfinput type="button" name="starter1" value="start" onclick="startprogress('du1')" />
<cfprogressbar name="du1" bind="cfc:progress.getstatus()" interval="1000" width="200" oncomplete="onFin" />
</p>
</cfform>
</body>
</html>
component output="false"
{
remote funktion getStatus(){
str = StructNew();
str.message = "blabla";
if(NOT IsDefined("session.STATUS")){
session.STATUS = 0.1;
Sleep(200);
}else if(session.STATUS LT 0.9){
session.STATUS =session.STATUS +.1;
Sleep(200);
}else{
str.message= "Done...";
session.STATUS=1.0;
}
str.status =session.STATUS;
return str;
}
}
当我打开t1.cfm
时,它会说:
找不到指定的CFC进度。 必须将CFC的路径指定为完整路径,或指定为当前模板的相对路径,而不使用映射。
我想问题出在bind="cfc:progress.getstatus()"
上,但我所遵循的教程做了完全相同的事情并且在那里工作。我做错了什么?
答案 0 :(得分:0)
认为你有一个错字:
remote funktion getStatus(){
应该是:
remote function getStatus(){
你把K放在功能中,而不是它需要的C.