Re: php and javascript



Joe Blow <Joe@xxxxxxxx> wrote:
> Hi,
>
> Is there any particular reason why JavaScript included in php include page
> does not work?

No, php is serverside and generates something for a client, it's up to
the cleint to interpret is if it's a correct syntax thingy.

> Will this be a browser security issue? It works with FireFox,
> but not with IE, which I suppose supports the browser security argument.

> I've found it is a general JavaScript problem, but an example is:
>
> <?php
> /*snip*/
> echo "<img src='../images/go.jpg'
> onclick='javascript:document.search_form.submit()' alt='go'
> style='margin-left: .2em; vertical-align: top; '>";
> /*snip*/
> ?>

Not a complete, standalone example.... the actuall error could be
anyware in the excluded source... (but the 'javascript:' is totally
unnecessary here).

> There are other ways to use an image as a submit button, I realise, and
> maybe I should just ditch the JavaScript, but it is an unexpected problem.

This is useless use of javascript indeed, take a look at the input
element's specs. There is a specific value to the type attribute that
allows an image as submit button!
.


Quantcast