Here's a method using a UDF... Mike's comments still hold, but this would
create a shorthand way for you to do it whether or not the <cfscript> block
is inside a javascript <script> block or not.

<cfscript>
function jsalert(message, createscriptblock) {
        if (createscriptblock) { writeoutput("<script language=""javascript"">"); }

        writeoutput("alert('#jsstringformat(message)#');");
        if (createscriptblock) { writeoutput("</script>"); }
}

jsalert("Hello World",true);
</cfscript>

<script language="javascript">
        <cfoutput>#jsalert("hello world",false)#</cfoutput>
</script>

hth

S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> Kris -
> Well, you can have CFScript write the javascript that will do
> this.  However, do not get the two confused.  CFScript is still server
> side
> scripting.
> <script language="javascript">
> <cfscript>
>          writeOutput("alert('hello world')");
> </cfscript>
> </script>

> Mike Wokasch
> UW-Extension
> At 10:25 AM 9/26/2002 -0400, you wrote:
>>Is there anyway to have Cfscript open an JS alert box for me???
>>
>>
>>Kris Pilles
>>Website Manager
>>Western Suffolk BOCES
>>507 Deer Park Rd., Building C
>>Phone: 631-549-4900 x 267
>>E-mail: [EMAIL PROTECTED]
>>
>>
>>
> 
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
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