Drop down menu & a submit button

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

    Drop down menu & a submit button

    I need a script that is not server side at all. I need a user to be
    able to select a month from a drop down box, and then the year from
    another. But to run I need them to be able to click a button to set
    the script running.

    The month options will be bookmarks (eg: #jan), and the year will to a
    different page (eg: 2003.html).
  • Olly

    #2
    Re: Drop down menu & a submit button

    olly854321@yaho o.co.uk (Olly) wrote in message news:<28e18e8f. 0405160629.2e9f 9333@posting.go ogle.com>...[color=blue]
    > I need a script that is not server side at all. I need a user to be
    > able to select a month from a drop down box, and then the year from
    > another. But to run I need them to be able to click a button to set
    > the script running.
    >
    > The month options will be bookmarks (eg: #jan), and the year will to a
    > different page (eg: 2003.html).[/color]

    I've now found a script that can manage only one drop down menu but i
    need mine to use two:

    <form name="jump">
    <select name="month">
    <option value="#jan">Ja nuary</option>
    <option value="#feb">Fe buary</option>
    <option value="#mar">Ma rch</option>
    <option value="#apr">Ap ril</option>
    <option value="#may">Ma y</option>
    </select>

    <select name="year">
    <option value="index.ht ml">2004</option>
    <option value="2003.htm l">2003</option>
    </select>

    <input type="button"
    onClick="locati on=document.jum p.month.options[document.jump.m onth.selectedIn dex].value;"
    value="GO">
    </form>

    Comment

    • Mick White

      #3
      Re: Drop down menu &amp; a submit button

      Olly wrote:
      [color=blue]
      > <form name="jump">
      > <select name="month">
      > <option value="#jan">Ja nuary</option>
      > <option value="#feb">Fe buary</option>
      > <option value="#mar">Ma rch</option>
      > <option value="#apr">Ap ril</option>
      > <option value="#may">Ma y</option>
      > </select>
      >
      > <select name="year">
      > <option value="index.ht ml">2004</option>
      > <option value="2003.htm l">2003</option>
      > </select>
      >
      > <input type="button"
      > onClick="locati on=document.jum p.month.options[document.jump.m onth.selectedIn dex].value;"
      > value="GO">
      > </form>[/color]

      onclick= "location=this. year.options[this.year.selec tedIndex].value+
      this.month.opti ons[this.month.sele ctedIndex].value;"
      Mick

      Comment

      • Olly

        #4
        Re: Drop down menu &amp; a submit button

        "Mick White" <mwhite13@BOGUS rochester.rr.co m> wrote in message
        news:rtNpc.2645 35$e17.223519@t wister.nyroc.rr .com...[color=blue]
        > Olly wrote:
        >[color=green]
        > > <form name="jump">
        > > <select name="month">
        > > <option value="#jan">Ja nuary</option>
        > > <option value="#feb">Fe buary</option>
        > > <option value="#mar">Ma rch</option>
        > > <option value="#apr">Ap ril</option>
        > > <option value="#may">Ma y</option>
        > > </select>
        > >
        > > <select name="year">
        > > <option value="index.ht ml">2004</option>
        > > <option value="2003.htm l">2003</option>
        > > </select>
        > >
        > > <input type="button"
        > >[/color][/color]
        onClick="locati on=document.jum p.month.options[document.jump.m onth.selectedIn
        dex].value;"[color=blue][color=green]
        > > value="GO">
        > > </form>[/color]
        >
        > onclick= "location=this. year.options[this.year.selec tedIndex].value+
        > this.month.opti ons[this.month.sele ctedIndex].value;"
        > Mick[/color]

        have i added the code in right cos it still doesn't work:
        <form name="jump">
        <select name="month">
        <option value="#jan">Ja nuary</option>
        <option value="#feb">Fe buary</option>
        <option value="#mar">Ma rch</option>
        <option value="#apr">Ap ril</option>
        <option value="#may">Ma y</option>
        </select>

        <select name="year">
        <option value="index.ht ml">2004</option>
        <option value="2003.htm l">2003</option>
        </select>

        <input type="button"
        onclick="locati on=this.year.op tions[this.year.selec tedIndex].value+this.mon t
        h.options[this.month.sele ctedIndex].value;" value="GO">
        </form>

        this is the error i get:
        Line: 34
        Char: 1
        Error: 'this.year.opti ons' is null or not an object
        Code: 0


        Comment

        • Lee

          #5
          Re: Drop down menu &amp; a submit button

          Olly said:
          [color=blue]
          >have i added the code in right cos it still doesn't work:
          ><form name="jump">
          ><select name="month">
          ><option value="#jan">Ja nuary</option>
          ><option value="#feb">Fe buary</option>
          ><option value="#mar">Ma rch</option>
          ><option value="#apr">Ap ril</option>
          ><option value="#may">Ma y</option>
          ></select>
          >
          ><select name="year">
          ><option value="index.ht ml">2004</option>
          ><option value="2003.htm l">2003</option>
          ></select>
          >
          ><input type="button"
          >onclick="locat ion=this.year.o ptions[this.year.selec tedIndex].value+this.mon t
          >h.options[this.month.sele ctedIndex].value;" value="GO">
          ></form>[/color]

          1. Remove the ".html" from the values of your year options,
          or you'll end up trying to find a page named "2003.html#may" .
          2. In the context of a button's onclick handler, "this" refers
          to the button. The button doesn't have year and month attributes.

          onclick="f=this .form;location= f.year.options[f.year.selected Index].value+f.month. options[f.month.selecte dIndex].value+'.html'"

          Comment

          • Olly

            #6
            Re: Drop down menu &amp; a submit button

            "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
            news:c88k8j01eb p@drn.newsguy.c om...[color=blue]
            > Olly said:
            >[color=green]
            > >have i added the code in right cos it still doesn't work:
            > ><form name="jump">
            > ><select name="month">
            > ><option value="#jan">Ja nuary</option>
            > ><option value="#feb">Fe buary</option>
            > ><option value="#mar">Ma rch</option>
            > ><option value="#apr">Ap ril</option>
            > ><option value="#may">Ma y</option>
            > ></select>
            > >
            > ><select name="year">
            > ><option value="index.ht ml">2004</option>
            > ><option value="2003.htm l">2003</option>
            > ></select>
            > >
            > ><input type="button"[/color]
            >
            >onclick="locat ion=this.year.o ptions[this.year.selec tedIndex].value+this.mon[/color]
            t[color=blue][color=green]
            > >h.options[this.month.sele ctedIndex].value;" value="GO">
            > ></form>[/color]
            >
            > 1. Remove the ".html" from the values of your year options,
            > or you'll end up trying to find a page named "2003.html#may" .
            > 2. In the context of a button's onclick handler, "this" refers
            > to the button. The button doesn't have year and month attributes.
            >
            >[/color]
            onclick="f=this .form;location= f.year.options[f.year.selected Index].value+f.m
            onth.options[f.month.selecte dIndex].value+'.html'"[color=blue]
            >[/color]

            Thanks it worked

            also for your first comment that's how I wanted the url to end up, so I took
            the +'.html' bit off the end of your code to set in the correct format for
            my needs.

            thanks again


            Comment

            • Lee

              #7
              Re: Drop down menu &amp; a submit button

              Olly said:[color=blue]
              >
              >"Lee" <REM0VElbspamtr ap@cox.net> wrote in message
              >news:c88k8j01e bp@drn.newsguy. com...[color=green]
              >> Olly said:
              >>[color=darkred]
              >> >have i added the code in right cos it still doesn't work:
              >> ><form name="jump">
              >> ><select name="month">
              >> ><option value="#jan">Ja nuary</option>
              >> ><option value="#feb">Fe buary</option>
              >> ><option value="#mar">Ma rch</option>
              >> ><option value="#apr">Ap ril</option>
              >> ><option value="#may">Ma y</option>
              >> ></select>
              >> >
              >> ><select name="year">
              >> ><option value="index.ht ml">2004</option>
              >> ><option value="2003.htm l">2003</option>
              >> ></select>
              >> >
              >> ><input type="button"[/color]
              >>
              >>onclick="loca tion=this.year. options[this.year.selec tedIndex].value+this.mon[/color]
              >t[color=green][color=darkred]
              >> >h.options[this.month.sele ctedIndex].value;" value="GO">
              >> ></form>[/color]
              >>
              >> 1. Remove the ".html" from the values of your year options,
              >> or you'll end up trying to find a page named "2003.html#may" .
              >> 2. In the context of a button's onclick handler, "this" refers
              >> to the button. The button doesn't have year and month attributes.
              >>
              >>[/color]
              >onclick="f=thi s.form;location =f.year.options[f.year.selected Index].value+f.m
              >onth.options[f.month.selecte dIndex].value+'.html'"[color=green]
              >>[/color]
              >
              >Thanks it worked
              >
              >also for your first comment that's how I wanted the url to end up, so I took
              >the +'.html' bit off the end of your code to set in the correct format for
              >my needs.[/color]

              Yes, of course. As I wrote that I was thinking that you were
              generating a page name, rather than a page and a hash.

              [color=blue]
              >
              >thanks again
              >
              >[/color]

              Comment

              Working...