473,396 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

php and javascript

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
3 1301
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.