#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Germany
    Posts
    27
    Rep Power
    0

    javascripts within php function


    can I write javascript code within <script >tag inside php function.

    Because when I use html within php function html does not work so I use print or echo function similarly i thought whether I can use java scripts wíthink php function ?.

    If yes , how can i do so.pls reply
    rajensama
  2. #2
  3. Web Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2001
    Location
    Finland
    Posts
    719
    Rep Power
    15
    The thing is that PHP is Server-Side. And JScript is Client-Side. You can use PHP to print javascript code that will then be executed by the browser but you cannot run javascript code within PHP code. It's not how it works.
    -- Tomi Kaistila
    -- Developer's Journal

    The more you learn, the more you know.
    The more you know, the more you forget.
    The more you forget, the less you know.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Germany
    Posts
    27
    Rep Power
    0
    I mean , can i treat java scripts also like html like you said.

    if its like that , i meán like you said then thanks , i will give a try
    thanks
    rajensama
  6. #4
  7. Web Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2001
    Location
    Finland
    Posts
    719
    Rep Power
    15
    I'm sorry, I misunderstood. Yes you can print javascript code like html code. Just be careful with the quotes.
    -- Tomi Kaistila
    -- Developer's Journal

    The more you learn, the more you know.
    The more you know, the more you forget.
    The more you forget, the less you know.

IMN logo majestic logo threadwatch logo seochat tools logo