By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,394 Members | 1,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,394 IT Pros & Developers. It's quick & easy.

php and javascript

P: n/a
Hi,

Is there any particular reason why JavaScript included in php include page
does not work? 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*/
?>

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.

Many thanks
JB
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Joe Blow" <Jo*@Blow.com> wrote in message
news:uM**************@read1.cgocable.net...
Hi,

Is there any particular reason why JavaScript included in php include page
does not work? 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*/
?>

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.

Many thanks
JB


Does the JavaScript work when placed in a simple HTML page? That will help
narrow down whether the problem is the JavaScript or the PHP code outputting
it...

Jul 17 '05 #2

P: n/a
Joe Blow (Jo*@Blow.com) decided we needed to hear...
Hi,

Is there any particular reason why JavaScript included in php include page
does not work? Will this be a browser security issue? It works with FireFox,
but not with IE, which I suppose supports the browser security argument.


No reason why Javascript echo'd from PHP shouldn't work. JS is client
side, not server side.
If it works in FF but not IE, then you probably have execution of JS
turned off in IE.

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Jul 17 '05 #3

P: n/a
Joe Blow <Jo*@blow.com> 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!
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.