| Subject: | Re: the Javascript Question?> |
|---|---|
| From: | GArlington <garlington@xxxxxxxxxxxxx> |
| Date: | Thu, 24 Jul 2008 08:00:28 -0700 (PDT) |
| Newsgroups: | macromedia.coldfusion.getting_started |
On Jul 24, 2:33 pm, "nightwolf666" <webforumsu...@xxxxxxxxxxxxxx>
wrote:
> I am just trying to create a feature when i get an error from the page like:
>
> abc.cfm?error="blahsgdhajhasdasdghafdhgasfhgafdhgasfdhgasfd"
> i was trying that the error should appear on the body onload event through
> javascript.
>
> I tried something but i did not came accross it.
>
> This was the code i am trying.
>
> <cfscript>
> function a()
> {
> var error = '#url.error#';
> }
> </cfscript>
> <cfoutput>
> <body onload="return alert('#error#');"></body>
> </cfoutput>
>
> It will be new thing for me if this gets work.
ALWAYS think about what you are trying to do...
CF runs on server, javascript runs on browser...
When CF runs var url.error is defined (because you pass it in your
url, BUT var error is NOT defined for CF.
You var error is javascript variable, CF DOES NOT know about it...
So, if you change your onload="a(); return alert(error);" it will
work...
Note: you NEED to call a() first to init your javascript var...
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Tutorial Confusion, alan_lindsay |
|---|---|
| Next by Date: | Re: the Javascript Question?>, Dan Bracuk |
| Previous by Thread: | the Javascript Question?>, nightwolf666 |
| Next by Thread: | Re: the Javascript Question?>, Dan Bracuk |
| Indexes: | [Date] [Thread] [Top] [All Lists] |