473,398 Members | 2,393 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,398 software developers and data experts.

Multiple Check Boxes URL Jump TIA

Tim
Hello All!

I'm having a difficult problem and I'm wondering if anyone can help.
Here's the deal.

I have a webpage with multiple forms on it. All of the forms have drop
down boxes that when selected and the corresponding button is pressed, the
user should be taken to a new website.

However, since I have 41 forms and 41 corresponding checkboxes, I would
like one function that can manage the 41 different forms.

Here's what I've tried so far, but it doesn't work. drop_num would be
the number of the form involved. In this case, all 41 forms are named as
follows: the first form is named Form1, the second Form2 and so forth all
the way till Form41. The drop down boxes are named as follows: the first
WebPage1, second WebPage2, etc.

The buttons activate the ChangeURL function with the OnClick() function.

function ChangeURL(drop_num)
{
if (navigator.appName.indexOf('Netscape') > -1) {
location.href = drop_num + "." + "WebPage" + drop_num + "." + "options["
+ drop_num + "." + "WebPage" + drop_num + "." + "selectedIndex].value";
}
else {
location.href = drop_num + "." + "WebPage" + drop_num + "." + "value";
}
}

Thanks in advance,

Tim

Jul 20 '05 #1
3 2520
"Tim" <mr********@yahoo.com> writes:
function ChangeURL(drop_num)
{
if (navigator.appName.indexOf('Netscape') > -1) {
That matches both Netscape 4 and Netscape 7, where Netscape 7 does have
the value directly on the select element.
location.href = drop_num + "." + "WebPage" + drop_num + "." + "options["
+ drop_num + "." + "WebPage" + drop_num + "." + "selectedIndex].value";


I assume the value of the option is the URL of the new page. Here, you
just create a string that ends in ".value", not the URL that it refers
to.

Try:

var sel = document.forms['Form'+drop_num].elements['WebPage'+drop_num];
location.href = sel.options[sel.selectedIndex].value;

If you want to support Netscape 4, you might as well *just* use the
above. It still works on all the newer browsers that also have the
value on the select element.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Why don't you put the form object into the function?
You can name all the listboxes the same then!

function changeURL(frm)
{
window.navigate(frm.webpagedropdown.value)
}

<form id="form1">
<select id="webpagedropdown">
[options go here]
</select>
<button onclick="changeURL(this.form)">
</form>

<form id="form2">
<select id="webpagedropdown">
[options go here]
</select>
<button onclick="changeURL(this.form)">
</form>

"Tim" <mr********@yahoo.com> wrote in message
news:jy*********************@twister.socal.rr.com. ..
Hello All!

I'm having a difficult problem and I'm wondering if anyone can help.
Here's the deal.

I have a webpage with multiple forms on it. All of the forms have drop
down boxes that when selected and the corresponding button is pressed, the
user should be taken to a new website.

However, since I have 41 forms and 41 corresponding checkboxes, I would like one function that can manage the 41 different forms.

Here's what I've tried so far, but it doesn't work. drop_num would be
the number of the form involved. In this case, all 41 forms are named as
follows: the first form is named Form1, the second Form2 and so forth all
the way till Form41. The drop down boxes are named as follows: the first
WebPage1, second WebPage2, etc.

The buttons activate the ChangeURL function with the OnClick() function.
function ChangeURL(drop_num)
{
if (navigator.appName.indexOf('Netscape') > -1) {
location.href = drop_num + "." + "WebPage" + drop_num + "." + "options[" + drop_num + "." + "WebPage" + drop_num + "." + "selectedIndex].value";
}
else {
location.href = drop_num + "." + "WebPage" + drop_num + "." + "value";
}
}

Thanks in advance,

Tim

Jul 20 '05 #3
Tim
Egbert,

Thank you! It works perfectly!

Tim
Why don't you put the form object into the function?
You can name all the listboxes the same then!

function changeURL(frm)
{
window.navigate(frm.webpagedropdown.value)
}

<form id="form1">
<select id="webpagedropdown">
[options go here]
</select>
<button onclick="changeURL(this.form)">
</form>

<form id="form2">
<select id="webpagedropdown">
[options go here]
</select>
<button onclick="changeURL(this.form)">
</form>

"Tim" <mr********@yahoo.com> wrote in message
news:jy*********************@twister.socal.rr.com. ..
Hello All!

I'm having a difficult problem and I'm wondering if anyone can help.
Here's the deal.

I have a webpage with multiple forms on it. All of the forms have drop down boxes that when selected and the corresponding button is pressed, the user should be taken to a new website.

However, since I have 41 forms and 41 corresponding checkboxes, I

would
like one function that can manage the 41 different forms.

Here's what I've tried so far, but it doesn't work. drop_num would be the number of the form involved. In this case, all 41 forms are named as
follows: the first form is named Form1, the second Form2 and so forth all the way till Form41. The drop down boxes are named as follows: the first
WebPage1, second WebPage2, etc.

The buttons activate the ChangeURL function with the OnClick()

function.

function ChangeURL(drop_num)
{
if (navigator.appName.indexOf('Netscape') > -1) {
location.href = drop_num + "." + "WebPage" + drop_num + "." +

"options["
+ drop_num + "." + "WebPage" + drop_num + "." + "selectedIndex].value";
}
else {
location.href = drop_num + "." + "WebPage" + drop_num + "." + "value"; }
}

Thanks in advance,

Tim


Jul 20 '05 #4

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

Similar topics

1
by: Pax S | last post by:
I need a button that will check (make true) two check boxes (fields) For the record that has the focus (the record on the form that I am presently looking at). The two check boxes would be like a...
1
by: Jim in Arizona | last post by:
I'm having dificulty figuring out how to process multiple check boxes on a web form. Let's say I have three check boxes: cbox1 cbox2 cbox3 The only way I can think of to code the...
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
10
by: Jim in Arizona | last post by:
I'm having dificulty figuring out how to process multiple check boxes on a web form. Let's say I have three check boxes: cbox1 cbox2 cbox3 The only way I can think of to code the...
6
by: Harshpandya | last post by:
Hi all, I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different...
25
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
6
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
7
by: Humakt | last post by:
This is 2D game where there are breakable boxes in the middle two bats on both sides and one or more balls breaking the boxes. Kind of like a mixup of pong and breakout. Collision detection...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.