开发者

How can I organize many results in a selectbox using php?

I have a select box that is part of a form. It is currently querying the addresses table and displaying the addresses into the select box. I plan on having up to 100 addresses.

I'm looking for a solution where I can sho开发者_如何学编程w all the states if the user clicks on the select box. Then if the user hovers over a state it will show all the addresses for that specific state. Then if the user clicks on an address, it will show that as the picked option in the select box. This is like a dropdown menu within a select box.

Does anyone know where I can find a solution as this?


You will need to pre-load all addresses to the client side, then use JavaScript or CSS to perform hover actions, otherwise your user would have to wait for ajax response if you choose to load on hover action. But i don't think that there is a pre-written script that will perform this exact task for you. But right away it sounds like a job for JQuery.

Edition:

Use javascript's onmouseover instead of CSS's :hover. CSS's :hover only works for <a> in IE


You didn't specify the server technology, so I am just going to go with a JS solution. What you have to do is not use a <select> element and use something like a drop-down menu.

Take your pick. You will have to customize the solution to suit your need obviously.

EDIT: Each final <a> in your drop down structure would have JavaScript to set a hidden <input> on the page so it can be posted.

EDIT 2: Check out this iPod style drill down menu:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜