Simple document changer in a frame.

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

    Simple document changer in a frame.

    Dear All

    I need to do something very simple with Javascript and have been looking
    all over the web for two days for a suitable script. I'm the kind of person
    who learns by seeing how it's done. I am a real beginner in programming.

    I am making a baking recipe site. For each section, say cookies, I will
    have around 100 recipes, which will be named sequentially, 001.html -
    100.html for example.

    I want to be able to have a simple navigation frame with buttons for first,
    previous, next and last with the recipes appearing in the content frame.
    The recipes are simple html pages with no images at this stage.

    Can anyone help?

    Many thanks in advance.


    Alan Clark
    Mature Student
    University of Hertfordshire.
    UK.


  • Dr John Stockton

    #2
    Re: Simple document changer in a frame.

    JRS: In article <Xns93D26D5EFC7 1Falanegglessco m@194.168.222.8 >, seen in
    news:comp.lang. javascript, Alan Clark <alan@eggless.c om> posted at Sat,
    9 Aug 2003 09:45:08 :-[color=blue]
    >Dear All
    >
    >I need to do something very simple with Javascript and have been looking
    >all over the web for two days for a suitable script. I'm the kind of person
    >who learns by seeing how it's done. I am a real beginner in programming.
    >
    >I am making a baking recipe site. For each section, say cookies, I will
    >have around 100 recipes, which will be named sequentially, 001.html -
    >100.html for example.
    >
    >I want to be able to have a simple navigation frame with buttons for first,
    >previous, next and last with the recipes appearing in the content frame.
    >The recipes are simple html pages with no images at this stage.[/color]

    You might do better to start at Number 100. Ignoring that, and starting
    on, say, 023.html

    Consider H = String(+H.subst ring(0,3)+1001) .substring(1, 4)+".html"
    with each H replaced by location.href and placed on each page as the
    action of a button; and similar with 999 instead of 1001. On the first
    and last pages, omit the inapplicable.

    Beginning & end just need direct assignment to location.href .

    Similar can presumably be used with frames.

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
    <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
    <URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
    <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

    Comment

    • Dr John Stockton

      #3
      Re: Simple document changer in a frame.

      JRS: In article <Xns93D26D5EFC7 1Falanegglessco m@194.168.222.8 >, seen in
      news:comp.lang. javascript, Alan Clark <alan@eggless.c om> posted at Sat,
      9 Aug 2003 09:45:08 :-[color=blue]
      >Dear All
      >
      >I need to do something very simple with Javascript and have been looking
      >all over the web for two days for a suitable script. I'm the kind of person
      >who learns by seeing how it's done. I am a real beginner in programming.
      >
      >I am making a baking recipe site. For each section, say cookies, I will
      >have around 100 recipes, which will be named sequentially, 001.html -
      >100.html for example.
      >
      >I want to be able to have a simple navigation frame with buttons for first,
      >previous, next and last with the recipes appearing in the content frame.
      >The recipes are simple html pages with no images at this stage.[/color]

      You might do better to start at Number 100. Ignoring that, and starting
      on, say, 023.html

      Consider H = String(+H.subst ring(0,3)+1001) .substring(1, 4)+".html"
      with each H replaced by location.href and placed on each page as the
      action of a button; and similar with 999 instead of 1001. On the first
      and last pages, omit the inapplicable.

      Beginning & end just need direct assignment to location.href .

      Similar can presumably be used with frames.

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

      Comment

      • Alan Clark

        #4
        Re: Simple document changer in a frame.

        Dr John Stockton <spam@merlyn.de mon.co.uk> wrote in message news:<lPZFPwF6J XN$Ew47@merlyn. demon.co.uk>...[color=blue]
        > JRS: In article <Xns93D26D5EFC7 1Falanegglessco m@194.168.222.8 >, seen in
        > news:comp.lang. javascript, Alan Clark <alan@eggless.c om> posted at Sat,
        > 9 Aug 2003 09:45:08 :-[color=green]
        > >Dear All
        > >
        > >I need to do something very simple with Javascript and have been looking
        > >all over the web for two days for a suitable script. I'm the kind of person
        > >who learns by seeing how it's done. I am a real beginner in programming.
        > >
        > >I am making a baking recipe site. For each section, say cookies, I will
        > >have around 100 recipes, which will be named sequentially, 001.html -
        > >100.html for example.
        > >
        > >I want to be able to have a simple navigation frame with buttons for first,
        > >previous, next and last with the recipes appearing in the content frame.
        > >The recipes are simple html pages with no images at this stage.[/color]
        >
        > You might do better to start at Number 100. Ignoring that, and starting
        > on, say, 023.html
        >
        > Consider H = String(+H.subst ring(0,3)+1001) .substring(1, 4)+".html"
        > with each H replaced by location.href and placed on each page as the
        > action of a button; and similar with 999 instead of 1001. On the first
        > and last pages, omit the inapplicable.
        >
        > Beginning & end just need direct assignment to location.href .
        >
        > Similar can presumably be used with frames.[/color]


        Thanks for the help John. It's a little hard for me to grasp
        immmediately. I've managed to alter some array code I downloaded and
        I've made it do what I want, but there is a great deal of redundancy.
        I have over 100 pages as I said and making over 100 array elements
        doesn't seem like good coding. As I said,my experience is very limited
        - mostly confined to programming DBase, with some instruction last
        year in VB on my course - which is 'Software Systems for the Arts and
        Media' at Hatfield.

        Here is what I've been altering...

        <SCRIPT LANGUAGE="javas cript" TYPE="text/javascript">
        <!-- Begin Previous Buttons script
        // place in HEAD section
        // script created by : THeMaRTy
        // website: http://marty.excudo.net
        // saved from url=(0050)http://marty.excudo.net/scripts/navigate/menu.html
        var count=1;
        // the array with the links
        // you can add as many links as you like, as long as you keep the
        numbers succeeding
        var link_array = new Array();
        link_array[1] = '001.html';
        link_array[2] = '002.html';
        link_array[3] = '003.html';
        link_array[4] = '004.html';
        link_array[5] = '005.html';
        link_array[6] = '006.html';
        // skip fwd
        function next()
        {
        if ((count + 1) >= link_array.leng th)
        {
        alert('That was the last page');
        }
        else
        {
        count = count + 1;
        parent.frames['main'].document.locat ion.href = link_array[count];
        }
        }
        // skip back
        function previous()
        {
        if ((count - 1) <= 0)
        {
        alert('This is the first page');
        }
        else
        {
        count = count - 1;
        parent.frames['main'].document.locat ion.href = link_array[count];
        }
        }
        // end -->
        </SCRIPT>


        Thanks for your help.

        Alan Clark

        Comment

        Working...