Home / Internet & Networking / Web design / Quick question
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Quick question  (Read 930 times)
Dilbert
Topic Starter
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« 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 » IP logged

"The geek shall inherit the Earth."
Zylstra
Moderator
Hacker



Thanked: 37
Posts: 5,274

Certifications: List
Experience: Guru
OS: Windows 7
The Techinator!

Technology News and Information 1
« 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.
IP logged

Dilbert
Topic Starter
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« 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>
IP logged

"The geek shall inherit the Earth."
Zylstra
Moderator
Hacker



Thanked: 37
Posts: 5,274

Certifications: List
Experience: Guru
OS: Windows 7
The Techinator!

Technology News and Information 1
« 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.
IP logged

Rob Pomeroy
Prodigy



Thanked: 119
Posts: 6,454

Experience: Expert
OS: Other


Web/Networking/Linux

Me
« 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.)
IP logged

Author of the fantasy thriller, Insensate - available for all ebook readers and iDevices. Find out more >here<. Only 99p/99¢!
Dilbert
Topic Starter
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« 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?
IP logged

"The geek shall inherit the Earth."
Rob Pomeroy
Prodigy



Thanked: 119
Posts: 6,454

Experience: Expert
OS: Other


Web/Networking/Linux

Me
« 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.
IP logged

Author of the fantasy thriller, Insensate - available for all ebook readers and iDevices. Find out more >here<. Only 99p/99¢!
Dilbert
Topic Starter
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« 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=". :-/
IP logged

"The geek shall inherit the Earth."
Rob Pomeroy
Prodigy



Thanked: 119
Posts: 6,454

Experience: Expert
OS: Other


Web/Networking/Linux

Me
« 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.  ;)
IP logged

Author of the fantasy thriller, Insensate - available for all ebook readers and iDevices. Find out more >here<. Only 99p/99¢!
Dilbert
Topic Starter
Moderator
Egghead



Thanked: 40
Posts: 3,480

Welcome to ComputerHope!

« 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. ;)
IP logged

"The geek shall inherit the Earth."
Rob Pomeroy
Prodigy



Thanked: 119
Posts: 6,454

Experience: Expert
OS: Other


Web/Networking/Linux

Me
« 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 » IP logged

Author of the fantasy thriller, Insensate - available for all ebook readers and iDevices. Find out more >here<. Only 99p/99¢!
Pages: [1] - (Top) Print 
Home / Internet & Networking / Web design / Quick question « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.108 seconds with 20 queries.