473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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).
Jul 23 '05 #1
6 1614
ol********@yahoo.co.uk (Olly) wrote in message news:<28**************************@posting.google. com>...
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).


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">January</option>
<option value="#feb">Febuary</option>
<option value="#mar">March</option>
<option value="#apr">April</option>
<option value="#may">May</option>
</select>

<select name="year">
<option value="index.html">2004</option>
<option value="2003.html">2003</option>
</select>

<input type="button"
onClick="location=document.jump.month.options[document.jump.month.selectedIndex].value;"
value="GO">
</form>
Jul 23 '05 #2
Olly wrote:
<form name="jump">
<select name="month">
<option value="#jan">January</option>
<option value="#feb">Febuary</option>
<option value="#mar">March</option>
<option value="#apr">April</option>
<option value="#may">May</option>
</select>

<select name="year">
<option value="index.html">2004</option>
<option value="2003.html">2003</option>
</select>

<input type="button"
onClick="location=document.jump.month.options[document.jump.month.selectedIndex].value;"
value="GO">
</form>


onclick= "location=this.year.options[this.year.selectedIndex].value+
this.month.options[this.month.selectedIndex].value;"
Mick
Jul 23 '05 #3
"Mick White" <mw******@BOGUSrochester.rr.com> wrote in message
news:rt*********************@twister.nyroc.rr.com. ..
Olly wrote:
<form name="jump">
<select name="month">
<option value="#jan">January</option>
<option value="#feb">Febuary</option>
<option value="#mar">March</option>
<option value="#apr">April</option>
<option value="#may">May</option>
</select>

<select name="year">
<option value="index.html">2004</option>
<option value="2003.html">2003</option>
</select>

<input type="button"
onClick="location=document.jump.month.options[document.jump.month.selectedIn
dex].value;" value="GO">
</form>


onclick= "location=this.year.options[this.year.selectedIndex].value+
this.month.options[this.month.selectedIndex].value;"
Mick


have i added the code in right cos it still doesn't work:
<form name="jump">
<select name="month">
<option value="#jan">January</option>
<option value="#feb">Febuary</option>
<option value="#mar">March</option>
<option value="#apr">April</option>
<option value="#may">May</option>
</select>

<select name="year">
<option value="index.html">2004</option>
<option value="2003.html">2003</option>
</select>

<input type="button"
onclick="location=this.year.options[this.year.selectedIndex].value+this.mont
h.options[this.month.selectedIndex].value;" value="GO">
</form>

this is the error i get:
Line: 34
Char: 1
Error: 'this.year.options' is null or not an object
Code: 0
Jul 23 '05 #4
Lee
Olly said:
have i added the code in right cos it still doesn't work:
<form name="jump">
<select name="month">
<option value="#jan">January</option>
<option value="#feb">Febuary</option>
<option value="#mar">March</option>
<option value="#apr">April</option>
<option value="#may">May</option>
</select>

<select name="year">
<option value="index.html">2004</option>
<option value="2003.html">2003</option>
</select>

<input type="button"
onclick="location=this.year.options[this.year.selectedIndex].value+this.mont
h.options[this.month.selectedIndex].value;" value="GO">
</form>


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.selectedIndex].value+f.month.options[f.month.selectedIndex].value+'.html'"

Jul 23 '05 #5
"Lee" <RE**************@cox.net> wrote in message
news:c8*********@drn.newsguy.com...
Olly said:
have i added the code in right cos it still doesn't work:
<form name="jump">
<select name="month">
<option value="#jan">January</option>
<option value="#feb">Febuary</option>
<option value="#mar">March</option>
<option value="#apr">April</option>
<option value="#may">May</option>
</select>

<select name="year">
<option value="index.html">2004</option>
<option value="2003.html">2003</option>
</select>

<input type="button"
onclick="location=this.year.options[this.year.selectedIndex].value+this.mon

t
h.options[this.month.selectedIndex].value;" value="GO">
</form>


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.selectedIndex].value+f.m
onth.options[f.month.selectedIndex].value+'.html'"


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
Jul 23 '05 #6
Lee
Olly said:

"Lee" <RE**************@cox.net> wrote in message
news:c8*********@drn.newsguy.com...
Olly said:
>have i added the code in right cos it still doesn't work:
><form name="jump">
><select name="month">
><option value="#jan">January</option>
><option value="#feb">Febuary</option>
><option value="#mar">March</option>
><option value="#apr">April</option>
><option value="#may">May</option>
></select>
>
><select name="year">
><option value="index.html">2004</option>
><option value="2003.html">2003</option>
></select>
>
><input type="button"
onclick="location=this.year.options[this.year.selectedIndex].value+this.mon

t
>h.options[this.month.selectedIndex].value;" value="GO">
></form>


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.selectedIndex].value+f.m
onth.options[f.month.selectedIndex].value+'.html'"


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.


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


thanks again


Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JS | last post by:
I have two drop/down menus that are dependant on each other. When I have made a choice in both of these menus and press a button I get to a page depending on the choice made. On this page there is...
1
by: phpnewb | last post by:
Hi, I know i'm doing it wrong, but I'm using a while loop right now to create several instances of a drop down menu. It gives me undesirable results. Can you tell me the right way to do it. Below are...
1
by: sparksol | last post by:
I have a form with a drop down box. If you select an option in the drop down box (depending which option is selected) one or two textbox(es) and a submit button display. I would like to keep the...
2
by: vinceboy | last post by:
Hi anybody. I am newbie here and would like to know that how can I validate both drop down menu and radio button from a dynamic display form.Something went wrong with my script.The radio button is...
0
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of the drop downs (News). The error occurs on all of...
2
by: EGdesign | last post by:
Hi everybody! does anyone know a script to have an eBay-style dropdown menu? (the one that shows up pointing on "Categories") thanx in advance for your answers.
0
by: Slickuser | last post by:
From my PHP page: Grab all data from the database. Go through a loop to generate the HTML. Client side: From the Color drop menu list, if a user change the value. It will grab that value &...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.