Javascript in a php page

Discussion in 'HTML & Website Design' started by Notting, Sep 1, 2007.

  1. #1
    I have copied and pasted the javascript code from google adwords conversion tracking straight into my "successful order" php page. Will this work, will a javascript work in a php page? If not how should I deal with it? Should I echo the script?

    Thanks
    Notting
     
    Notting, Sep 1, 2007 IP
  2. Notting

    Notting Notable Member

    Messages:
    3,210
    Likes Received:
    335
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Anyone?

    Notting
     
    Notting, Sep 2, 2007 IP
  3. GWiz

    GWiz Peon

    Messages:
    359
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It should work... try using:

    <script type="text/javascript" src="[B]your_file.js[/B]"></script>
    Code (markup):
     
    GWiz, Sep 2, 2007 IP
  4. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #4
    yes. that will work with php files but you should place it out of php codes
    everywhere you want place codes close php tags with : ?>
    place your code and open your php tag again with <?php
    because adsense code use " or ' and this character will break your php codes
     
    James.Blant, Sep 2, 2007 IP
  5. krazyj

    krazyj Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    try echoing it as HTML remembering to escape characters like " (meaning if you have a " you need to type it as \")
     
    krazyj, Sep 2, 2007 IP