Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Location
    Fort Irwin California
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    IN, USA
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Jan 2003
    Location
    Fort Irwin California
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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>

  • #5
    New to the CF scene
    Join Date
    Jan 2003
    Location
    Fort Irwin California
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #6
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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>

  • #7
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #8
    New to the CF scene
    Join Date
    Jan 2003
    Location
    Fort Irwin California
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •