Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-15-2003, 10:43 PM   PM User | #1
Massham1
New to the CF scene

 
Join Date: Jan 2003
Location: Fort Irwin California
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Massham1 is an unknown quantity at this point
Thumbs down Jump Menu OnChange Command Problem

I have a jump menu that I would like to user for url's & html pages. However, it keeps giving me an "object required" error message. I have success when I use a go button, but can't get the "OnChange" command to work. I don't want to use a go, or submit button. I have searched my JavaScript bible to help me, but can't fine the solution. Help Please

Last edited by Massham1; 01-15-2003 at 10:49 PM..
Massham1 is offline   Reply With Quote
Old 01-15-2003, 10:53 PM   PM User | #2
CRASH_OVERRIDE
Regular Coder

 
Join Date: Aug 2002
Location: IN, USA
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
CRASH_OVERRIDE is an unknown quantity at this point
I would have to see the code, but 'Object Required' commonly means that you:
- Havent specified an object to get the method from;
- Have mistyped the object or method name;
- Are specifying a object or method that doesnt exist;
- Other possibilities...

Im pretty sure thats right, this is based on my experience, but spare me if im wrong.
__________________
Just call me Crash...
"Crash- and BURN!"
-Cereal Killer
CRASH_OVERRIDE is offline   Reply With Quote
Old 01-15-2003, 11:22 PM   PM User | #3
Massham1
New to the CF scene

 
Join Date: Jan 2003
Location: Fort Irwin California
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Massham1 is an unknown quantity at this point
Cool jump menu "onChange" reply

Mr. Crash:

Thank you for your expedient response! Please see the following scrpt:

Header:

<script language="JavaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>

Body:

<select name="ListBoxURL" size="1" language="javascript" onchange="gotoLink(this.form);">
<option value="http:\\www.irwin.army.mil\default.htm">Test</option>
<option value="URL #2.htm">Place 2 </option>
<option value="URL#3.htm">Place 3 </option>
<option selected> -- Select to Jump -- </option>
</select>
Massham1 is offline   Reply With Quote
Old 01-16-2003, 12:03 AM   PM User | #4
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
Is your <select> box within a <form> ?

Code:
<html>
<head>
<script language="JavaScript"> 
<!-- 
function gotoLink(form) { 
	var OptionIndex=form.ListBoxURL.selectedIndex; 
	parent.location=form.ListBoxURL.options[OptionIndex].value;
} 
//--> 
</script> 
</head>

<body>
<form name="myform">
<select name="ListBoxURL" onchange="gotoLink(this.form);"> 
<option value="http://www.irwin.army.mil/default.htm">Test</option> 
<option value="URL2.htm">Place 2 </option> 
<option value="URL3.htm">Place 3 </option> 
<option selected> -- Select to Jump -- </option> 
</form>
</select>
</body>

</html>
arnyinc is offline   Reply With Quote
Old 01-16-2003, 12:33 AM   PM User | #5
Massham1
New to the CF scene

 
Join Date: Jan 2003
Location: Fort Irwin California
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Massham1 is an unknown quantity at this point
Cool Jump Menu OnChange Command Problem

I may be confused about what a form refers to. However, I do believe I am using one based on this:::

I have a drop-down menu; I believe this is what is considered a form. I am using FrontPage to edit and a drop-down is referred to as a form in this arena.

I am sorry about my confusion; I am very new to JS and web development. I have figured out a lot of stuff, but I am stuck on this one.

I appreciate your assistance.
Massham1 is offline   Reply With Quote
Old 01-16-2003, 03:32 AM   PM User | #6
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
I am referring to the part of your code where you have:

Body:
Code:
<select name="ListBoxURL" size="1" language="javascript" onchange="gotoLink(this.form);"> 
<option value="http:\\www.irwin.army.mil\default.htm">Test</option> 
<option value="URL #2.htm">Place 2 </option> 
<option value="URL#3.htm">Place 3 </option> 
<option selected> -- Select to Jump -- </option> 
</select>
it should be: (note the addition of the first and last lines)

Code:
<form name="myform">
<select name="ListBoxURL" onchange="gotoLink(this.form);"> 
<option value="http://www.irwin.army.mil/default.htm">Test</option> 
<option value="URL2.htm">Place 2 </option> 
<option value="URL3.htm">Place 3 </option> 
<option selected> -- Select to Jump -- </option> 
</select>
</form>
arnyinc is offline   Reply With Quote
Old 01-16-2003, 05:23 AM   PM User | #7
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
http://www.codingforums.com/showthre...threadid=13046
__________________

Moderator: General web building

Get out from under them, resist and multiply.
Get out from under precipice and see the sky.
cg9com is offline   Reply With Quote
Old 01-16-2003, 05:07 PM   PM User | #8
Massham1
New to the CF scene

 
Join Date: Jan 2003
Location: Fort Irwin California
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Massham1 is an unknown quantity at this point
Thumbs up Jump Menu OnChange Command Problem

Arnyinc/Crash

Thank you for your help. Arnyinc, I was missing the form tag; it works like a champ.

many thanks!

massham1
Massham1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:56 PM.


Advertisement
Log in to turn off these ads.