Loading a page in a frame

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

    #1

    Loading a page in a frame

    I have the following HTML page (see bottom of message) that consists of a
    frame with two windows. The top window is always the menu, and the bottom
    window is by default a document named "TheDesc.ht m". However, if another
    page is called, I want to display this new page into the bottom frame in
    place of "TheDesc.ht m".

    My problem is with the third document.write command in the SCRIPT section.

    document.write( '<FRAME SRC="+%20(%20lo cation.search%2 0?
    location.search .substring(1):" TheDesc.htm") + NAME="MAIN">');

    I get an error message when calling another page, like:



    Any idea what is wrong with this line?

    BTW, I got this script from a web site, so I'm not sure I fully understand
    this like. What %20 means.

    Richard


    <HTML>
    <HEAD>
    <SCRIPT language="JavaS cript">
    document.write( '<FRAMESET FRAMEBORDER="0" BORDER="0" FRAMESPACING="0 "
    ROWS="121,85%"> ');
    document.write( '<FRAME SRC="TheMenu.ht m" NAME="MENU" MARGINWIDTH="0"
    MARGINHEIGHT="0 ">');
    document.write( '<FRAME SRC="+%20(%20lo cation.search%2 0?
    location.search .substring(1):" TheDesc.htm") + NAME="MAIN">');
    document.write( '<\/FRAMESET>');
    </SCRIPT>
    </HEAD>
    <FRAMESET FRAMEBORDER="0" BORDER="0" FRAMESPACING="0 " ROWS="125,84%">
    <FRAME SRC="TheMenu.ht m" NAME="MENU" MARGINWIDTH="0" MARGINHEIGHT="0 ">
    <FRAME SRC="TheDesc.ht m" NAME="MAIN" MARGINWIDTH="8" >
    <NOFRAMES>
    <BODY>
    Viewing this page requires a browser capable of displaying frames.
    </BODY>
    </NOFRAMES>
    </FRAMESET>
    </HTML>


  • Michael Winter

    #2
    Re: Loading a page in a frame

    On Mon, 19 Apr 2004 11:35:24 -0400, RichardM <RichardM@nospa m.ca> wrote:

    [snip]
    [color=blue]
    > My problem is with the third document.write command in the SCRIPT
    > section.
    >
    > document.write( '<FRAME SRC="+%20(%20lo cation.search%2 0?
    > location.search .substring(1):" TheDesc.htm") + NAME="MAIN">');[/color]

    That statement appears to be complete rubbish. What you probably want is

    document.write( '<frame src="' + location.search .substring( 1 ) +
    '" name="MAIN">');

    [snip]
    [color=blue]
    > BTW, I got this script from a web site, so I'm not sure I fully
    > understand this like. What %20 means.[/color]

    The number of usable characters in a URI is limited. To escape restricted
    characters, you take the character code, convert it to hexadecimal, and
    prefix a percentage symbol. %20 represents a space.
    [color=blue]
    > <SCRIPT language="JavaS cript">[/color]

    SCRIPT elements require a type attribute, which negates the need for the
    language attribute. The above should read

    <script type="text/javascript">

    [snip]

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    Working...