Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Quick question  (Read 4489 times)

0 Members and 1 Guest are viewing this topic.

Dilbert

    Topic Starter
  • Moderator


  • Egghead

  • Welcome to ComputerHope!
  • Thanked: 44
    Quick question
    « on: August 09, 2006, 04:54:41 PM »
    This seems simple, but I'm getting headaches trying to make it work...

    I have a drop-down menu on a web page. I want to make it so that when the user clicks on an option, they are taken to that page.

    I heard something about "onclick" but I also heard that won't work in IE (*censored*, does anything work in IE???). I also heard about the <select> tag having a "onchange" event, but I haven't been able to find anything of the sort.
    I have an idea, but no idea how to implement it. Can I make a onchange event for the <select> so that it changes pages to the value of the selected option?
    « Last Edit: August 09, 2006, 04:59:52 PM by Timothy_Bennett »
    "The geek shall inherit the Earth."

    Zylstra

    • Moderator


    • Hacker

    • The Techinator!
    • Thanked: 45
      • Yes
      • Technology News and Information
    • Certifications: List
    • Computer: Specs
    • Experience: Guru
    • OS: Windows 7
    Re: Quick question
    « Reply #1 on: August 09, 2006, 05:41:46 PM »
    Quote
    This seems simple, but I'm getting headaches trying to make it work...

    I have a drop-down menu on a web page. I want to make it so that when the user clicks on an option, they are taken to that page.

    I heard something about "onclick" but I also heard that won't work in IE (*censored*, does anything work in IE???). I also heard about the <select> tag having a "onchange" event, but I haven't been able to find anything of the sort.
    I have an idea, but no idea how to implement it. Can I make a onchange event for the <select> so that it changes pages to the value of the selected option?
    What you area talking about with "onclick" are the behaviours of the HTML item.
    It is compatible with IE (if we are thinking the same thing)
    There are a few actions:
    Onclick
    Onmousedown
    onmouseup
    onmouseover
    ondoubleclick
    (Please, dont try these right now! If you have dreamweaver, please tell me so I can give better directions)
    some of these really don't work with ANY browser...
    As for getting to the page by clicking, lettith me findith out...

    Much as we all dislike Bravenet for their excessive advertising:
    http://resources.bravenet.com/minitools/dhtml_menu_generator/

    It will generate the DHTML code you need, and allow you to get it on your site ASAP.

    Dilbert

      Topic Starter
    • Moderator


    • Egghead

    • Welcome to ComputerHope!
    • Thanked: 44
      Re: Quick question
      « Reply #2 on: August 09, 2006, 05:59:48 PM »
      What I'm saying is that I want to make it so that if a user clicks on a certain item on a drop-down menu, they are taken to a corresponding page. Yes, onclick works, but IE won't support it in the <option> tag. The code, I hear, is in the <select> tag, and this will work on all platforms. Something about onchange, which is a valid part of the select tag.

      To get a clearer understanding, this is the skeleton of my HTML hierarchy:

      <html>
      <head>
      <title></title>
      </head>
      <body>
      <select>
      <option></option>
      <option></option>
      <option></option>
      <option></option>
      <option></option>
      </select>

      </body>
      </html>
      "The geek shall inherit the Earth."

      Zylstra

      • Moderator


      • Hacker

      • The Techinator!
      • Thanked: 45
        • Yes
        • Technology News and Information
      • Certifications: List
      • Computer: Specs
      • Experience: Guru
      • OS: Windows 7
      Re: Quick question
      « Reply #3 on: August 09, 2006, 06:28:45 PM »
      Hmm. This is when Dreamweaver becomes a miracle.
      Just out of curiosity:
      Did you try the Bravenet tool? I think it will do exactly what you need it to.

      Rob Pomeroy



        Prodigy

      • Systems Architect
      • Thanked: 124
        • Me
      • Experience: Expert
      • OS: Other
      Re: Quick question
      « Reply #4 on: August 09, 2006, 08:17:44 PM »
      What's the problem, Dilbert?  onChange in the SELECT element is exactly what you need.  Use a javascript redirect based on the value of the SELECT control.

      You should also provide functionality for the user via a "GO" button, in case they have javascript off.  (You can hide this button using javascript, so that those with it on won't see it.)
      Only able to visit the forums sporadically, sorry.

      Geek & Dummy - honest news, reviews and howtos

      Dilbert

        Topic Starter
      • Moderator


      • Egghead

      • Welcome to ComputerHope!
      • Thanked: 44
        Re: Quick question
        « Reply #5 on: August 10, 2006, 07:24:47 PM »
        Well, my problem is that I don't know much about JavaScripting and I have no idea what code to use. I found this:

        Code: [Select]
        window.location = "(URL)"
        The only problem with this is that I intend to use frames. How can I target another frame with JavaScript?
        "The geek shall inherit the Earth."

        Rob Pomeroy



          Prodigy

        • Systems Architect
        • Thanked: 124
          • Me
        • Experience: Expert
        • OS: Other
        Re: Quick question
        « Reply #6 on: August 11, 2006, 01:02:56 AM »
        Something like
        top.window.yourFrame'sName.location.href = ...
        or
        top.window.parentFrame'sName.childFrame'sName.location.href =
        if you have nested frames.

        But a word to the wise: avoid frames if you possibly can.  I have yet to to see a frames-based layout that didn't look lame, particularly because of extra scrollbars.  There will be a better way.
        Only able to visit the forums sporadically, sorry.

        Geek & Dummy - honest news, reviews and howtos

        Dilbert

          Topic Starter
        • Moderator


        • Egghead

        • Welcome to ComputerHope!
        • Thanked: 44
          Re: Quick question
          « Reply #7 on: August 11, 2006, 09:35:38 AM »
          Oh, I know. But I can't find an equivalent. (Sure, the <object> tag can work, but I have yet to find code that will do the equvalent of "target=". :-/
          "The geek shall inherit the Earth."

          Rob Pomeroy



            Prodigy

          • Systems Architect
          • Thanked: 124
            • Me
          • Experience: Expert
          • OS: Other
          Re: Quick question
          « Reply #8 on: August 12, 2006, 12:30:17 AM »
          Why would you even do that?  Code each page individually, if you want a clean interface.  If you want sections of the page that are self-contained and change without the rest of the page changing, consider using Flash.

          But whatever works for you.  ;)
          Only able to visit the forums sporadically, sorry.

          Geek & Dummy - honest news, reviews and howtos

          Dilbert

            Topic Starter
          • Moderator


          • Egghead

          • Welcome to ComputerHope!
          • Thanked: 44
            Re: Quick question
            « Reply #9 on: August 15, 2006, 01:48:33 PM »
            Besides, I'm technically employed, so I do what the boss (mother) tells me to do. ;)
            "The geek shall inherit the Earth."

            Rob Pomeroy



              Prodigy

            • Systems Architect
            • Thanked: 124
              • Me
            • Experience: Expert
            • OS: Other
            Re: Quick question
            « Reply #10 on: August 16, 2006, 04:43:04 AM »
            Nonsense.  Give the client what she needs, not what she wants!

            ;)
            « Last Edit: August 16, 2006, 04:43:38 AM by robpomeroy »
            Only able to visit the forums sporadically, sorry.

            Geek & Dummy - honest news, reviews and howtos