php and javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Blow

    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='javasc ript:document.s earch_form.subm it()' 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


  • Tony

    #2
    Re: php and javascript

    "Joe Blow" <Joe@Blow.com > wrote in message
    news:uMnme.482$ Id.400@read1.cg ocable.net...[color=blue]
    > 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='javasc ript:document.s earch_form.subm it()' 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[/color]

    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...



    Comment

    • Dave

      #3
      Re: php and javascript

      Joe Blow (Joe@Blow.com) decided we needed to hear...[color=blue]
      > 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.
      >[/color]

      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 <dave@REMOVEbun dook.com>
      (Remove REMOVE for email address)

      Comment

      • Daniel Tryba

        #4
        Re: php and javascript

        Joe Blow <Joe@blow.com > wrote:[color=blue]
        > Hi,
        >
        > Is there any particular reason why JavaScript included in php include page
        > does not work?[/color]

        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.
        [color=blue]
        > Will this be a browser security issue? It works with FireFox,
        > but not with IE, which I suppose supports the browser security argument.[/color]
        [color=blue]
        > I've found it is a general JavaScript problem, but an example is:
        >
        > <?php
        > /*snip*/
        > echo "<img src='../images/go.jpg'
        > onclick='javasc ript:document.s earch_form.subm it()' alt='go'
        > style='margin-left: .2em; vertical-align: top; '>";
        > /*snip*/
        > ?>[/color]

        Not a complete, standalone example.... the actuall error could be
        anyware in the excluded source... (but the 'javascript:' is totally
        unnecessary here).
        [color=blue]
        > 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.[/color]

        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!

        Comment

        Working...