Results 1 to 9 of 9

Thread: Javascipt (include another page)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Question

    Ok I have these two different webpages. One has about two lines of text (page y) on and the other is a full page with content (page x).

    What I would like to do is be able to include page y on page x or for that matter include page y on any page in my website. I know you can do this in frontpage but its method is clummsy and doesn't work well. I am basically looking for a Javascipt that would let me include one page on another, anyone know how to write such a script?

    Jeremy

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Here's one way...

    pageX.html
    Code:
    <HTML>
    
    <body>
    
    page X page x page X <BR>
    page X page x page X <BR>
    page X page x page X <BR>
    page X page x page X <BR>
    
    
    <SCRIPT SRC="pageY.js"><!--
    //--></SCRIPT>
    page X page x page X <BR>
    page X page x page X <BR>
    page X page x page X <BR>
    page X page x page X <BR>
    
    </body>
    </HTML>
    pageY.js
    Code:
    document.write('Hello. This is a line from pageY<BR>');
    document.write('Second line from pageY<BR>');
    Mark
    -------------------

  3. #3
    Guest
    As I have posted in the other thread - this web site may help for this problem and other java scripts you might want to use. The web site is : -

    http://www.javascriptsource.com

    Have fun!!!!!

  4. #4
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    does it have to use javascript? You could do it very easy by using a server side include. But if it must be javascript, mark's way is the best.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    zippa Try it and see!

    rculver One thing that really annoys me is "have a look at this site there might be somthing there" sort of replies. EXACT links please!

    I had a quick look at javascriptsource and I wasn't impressed. I got javascript errors and that was using IE5!!!!!!!

    I use www.irt.org as a main source of reference.

    Jeremy Martin as, sail3005 says, reading the page on the server side is the best (only) way to do it because you would then be able to replace line feeds with <BR>s and the like.

    Is server-side scripting an option for you?
    Mark
    -------------------

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    Yes server side scripting is certinaly an option but I not really done this so if someone could point me in the right direction that would be verry appreciated.

    Jeremy

  7. #7
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    Here is an example:

    some common include types are .inc, .asp, .shtml.

    included.inc:
    Code:
    put your page contents here
    then put this in the page that you want the add the above page to:
    Code:
    <!--#include file="included.inc"-->
    
    -or-
    
    <!--#include virtual="included.inc"-->
    file will look for the file in the directory that you have it in, or a directory below it.

    virtual will start in the root directory.

    hope this helps. If you need any more help let me know, because this is one are that i am actually good in!

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  8. #8
    New Member
    Join Date
    Sep 2000
    Posts
    7
    Mark: Javascript has a 40 word limit or something of that sort inside "document.write" doesn't it?

  9. #9
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    zippa: I wasn't aware of a limit but you could use multiple document.write()s
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width