저는 HTML 및 Coldfusion에서 작업하고 있습니다. CF에서 변수를 0으로 설정하고 HTML 변수의 값을 1로 변경하는 스크립트를 onclick 이벤트 트리거로 설정합니다. 그런 다음 변수에 하나가 있으면 true 인 cfif를 실행할 수 있습니다. 누구든지이 일을하는 가장 좋은 방법을 알고 있습니까? 이것은 내가 뭘 시도하고 있지만 onClick 아무것도 유용한 방아쇠를 당하지 않습니다.HTML 변수를 onclick하려면 어떻게해야합니까?
<cfset dayHolder = 0>
<!--- Make a Submit Button --->
<div style="max-width:50%; margin: auto; padding-top: 20px; text-align: center">
<input type="button" name="submit" onclick="setupVar();" value="Submit Day Page" tooltip="Submits Your Hour by Hour"
style="font-family:Times New Roman; font-size:16px;"/>
</div>
<script>
function setupVar(){
dayHolder=1;
return dayHolder;
}
</script>
<cfoutput> #dayHolder#</cfoutput>
<br>
<!--- Send the data to the database --->
<cfif 'dayHolder' eq 1>
etc...
대단히 감사합니다.
자바 스크립트에서 CFML 코드를 실행할 수 없습니다. 그것은 ajax를 사용하거나 양식을 제출하여 새로운 http 요청을 요구합니다. – Ageax