Html and Javascript in CFSCRIPT tag.
Hello Friends,
In coldfusion programming we need to use javascript any time. We can easily do this. We can not write directly javascript in CFSCRIPT tag. There is one way to write javascript in CFSCRIPT tag. Look below code. I hope you may find it interesting.
<cfscript>
WriteOutput('
<script language="JavaScript">
str = confirm("Do you like the cfscript tag?");
if (str == true)
alert("Yes, I like it.");
else if (str == false)
alert("No, I do not like.");
</script>
');
</cfscript>
<cfscript>
WriteOutput('
<h1>Html using cfscript</h1>
');
</cfscript>
Comments
- Pritesh
-
Major difference between cfscript and script is both run on different platform. CFSCRIPT runs on server and SCRIPT runs on client browser. This way we are writing javascript code to browser like other HTML tags.
- December 28, 2009, 11:01 PM
- Reply
NOTE : Comments are moderated, and will not appear until the author has approved them.