>I am having some trouble with some of my javascript
>
>Well my code works within
>
><script></script> tages
>But when I put them in <Cfscript></cfscript> tags it doesn't here is the
>code:
>
>A couple functions I use throughouit my app::
>
>       <cfscript>
>               alert("Invalid SSN");
>               window.parent.document.forms[0].SSN.select();
>       </cfscript>
>
>       <cfscript>
>       window.parent.document.forms[0].first.value = '#firstname#';
>       window.parent.document.forms[0].last.value = '#lastname#';
>       </cfscript>
>
>       <cfscript>
>               alert("Invalid SSN Format");
>               window.parent.document.forms[0].SSN.select();
>       </cfscript>
>
><script>
>function ConfirmSSN(sSSN)
>{
>       document.all.WorkFrame.src = "confirmSSN.cfm?SSN=" + sSSN;
>}
>
>function enterinfo()
>       {
>       document.employee.lastname.value = retlname;
>       document.employee.firstname.value = retfname;
>       }
></script>
>
>I thought that the syntax between javascript and cfscript was pretty
>much interchangeable?? What is my problem???
>

Kris,

As I'm sure several people will point out, most likely before my response, 
you are confusing <cfscript> with <script>. <cfscript> is intended to run 
*server-side* ColdFusion commands only, not client-side, which is where 
Javascript comes into play. These are two completely different monsters, and 
are not interchangeable, as you're trying to do in your examples. You do not 
have access to the DOM using <cfscript> because, as I said, the code within 
<cfscript> is only run on the server. Using <cfscript> is the same as typing 
<cfset varname = "value"> -- both are processed via the CF engine, not the 
client's browser.

Furthermore, in <cfscript>, you cannot use any ColdFusion tags. You can only 
use built-in CF functions, modified loop syntax, variable setting, and 
user-defined functions.

Hope this helps you out a bit.

Regards,
Dave.




______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to