Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a question, and I hope this one hasn't been asked too frequently; if
so, I apologize in advance.

I've heard over time that it isn't a good idea to intermingle JavaScript
with PHP code.  Maybe that's a fallacy, and maybe not, but if so, would
someone care to enlighten me as to why this might be the case?

Thanks in advance for any responses.

Randy Jackson

Re: JavaScript?

On Sat, 10 Jul 2004 16:32:43 GMT, Randy Jackson

Quoted text here. Click to load it

 Well, you can't intermingle the two, since they won't run on the same machine

 What you can do is output Javascript source code from PHP for execution by the

 What you shouldn't do is _rely_ on that Javascript to do anything, such as
validation or filling in fields, since you don't have any control over the
remote environment.

--          /

Re: JavaScript?

Quoted text here. Click to load it

It just gets really confusing, that's all. Slashes can get totally out of
control when you have Javascript code sitting inside a PHP string. Here's an
extreme case:

echo "var re = new RegExp('\\\\', 'g');";

All the thing does is look for one backslash.

Site Timeline