Results 1 to 7 of 7

Thread: using <script src="">

  1. #1
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default using <script src="">

    Ive come across many sites displaying a page or a part of page with this type of code.

    here s an example:

    Code:
    <script src= http://www.gocurrency.com/v2/gocurrcalc_t.php?id=53> </script>
    Does it only work for .php, or is it possible to display .htm or through document.write as well?

    If so, how?

  2. #2
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    it's more complicated than this (you will need AJAX implemented), however it has nothing to do with the document.write(), it's just because a PHP script can generate a javascript code and pass it to client (just with appropriate mime type: text/javascript).

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, what's happening there is that the PHP script is generating Javascript.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    No, what's happening there is that the PHP script is generating Javascript.
    I tried that with simple .htm files, which didnt work.

    Is it possible for for .htm or similar to do the same thing with it or is it just restricted to .php?

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's not restricted to PHP, but it can't be done with HTML. A valid HTML page is not a valid Javascript file, and vice versa. PHP (and all other server-side scripting languages) are capable of generating any type of file.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok, so is it possible to display like a paragraph of just simple text through document.write or something similar with javascript?

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It is possible, but it is strongly advised to use server-side scripting for this purpose.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •