# Show Dropdown box on click of link



## ashras99 (Jul 13, 2002)

I am adding a country drop down box on a page which will be visible when click on Country link...otherwise that will be hidden. Please tell me how to do this...may be some javascript...because right now i have to load another page to make visible. Please help...


----------



## deepdiver01 (Dec 23, 2004)

You can put a drop down box onto a page using html with something like this.


```
<table>
  <tr>
    <td width="300"><select name="billing_country">
          <option selected>Country</option>
          <option value="AF">Afghanistan</option>
          <option value="AL">Albania</option>
          <option value="DZ">Algeria</option>
          <option value="AS">American Samoa</option>
          <option value="AD">Andorra</option>
          <option value="AO">Angola</option>
          <option value="AI">Anguilla</option>
    </td>
  </tr>
<table>
```
Is this what you are looking for?


----------



## ashras99 (Jul 13, 2002)

No i am not looking this...I already given above code on my page....but I want this drop down box is only visible when clicking the Country hyperlink, otherwise not visible. And also for showing the dropdown box...no other page loaded...visible in same page. Hope you understand...my point.


----------



## deepdiver01 (Dec 23, 2004)

Ok.

Have a look at

http://javascript.internet.com/page-details/smart-popup.html

It will give you the code of how to create a pop up window.

You can easily change the link name and add whatever you need into the new window.

Hope that this is closer to what you want.


----------



## ashras99 (Jul 13, 2002)

Friend this is not close what i want. I dont need a popup window, i asked to visible the dropdown menu on a page by just clicking the hyperlink.


----------



## namenotfound (Apr 30, 2005)

I think you want this, it's called "AnyLink Drop Down Menu"

http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

The second example in "step 2" is the one you want. It will show the countries only when you click on the link


----------



## ashras99 (Jul 13, 2002)

No, I dont require this....Please have a look following page...

http://sharekhan.com/KnowledgeCentre/Sharekhan_FAQ.aspx

When you click on any question then answer shows...i want the same functionality with drop-down box. Shows on a click. But i am using linux server.


----------



## namenotfound (Apr 30, 2005)

Oh, so you don't want a "drop down" you want an "expand/collapse"

Try this
http://www.scriptygoddess.com/archives/2003/01/16/showhide-anything/


----------



## ashras99 (Jul 13, 2002)

Exactly i need that please have a look the following page....

http://cgarena.com/hide.html

Right now country hyperlink is hide on click, please tell me how to make available on click. (not hide)


----------



## Eriksrocks (Aug 7, 2005)

At the end of the page you have this:


```
[URL=#]


[/URL]
```
You need this


```
[URL=#]

Hide Country

[/URL]
```


----------



## ashras99 (Jul 13, 2002)

I dont want to show the text anywhere else, I want the text comes at the same place where previouss one hyperlink is coming. I dont think above change will do this.


----------



## Rockn (Jul 29, 2001)

The code is right in the page if you want to creatively "borrow" it and sue it as your own. All it is doing is showing and hiding divs with the onClick event.


----------



## iltos (Jun 13, 2004)

will any of these work?
http://jdstiles.com/java/navigation.html


----------



## Eriksrocks (Aug 7, 2005)

ashras99 said:


> I dont want to show the text anywhere else, I want the text comes at the same place where previouss one hyperlink is coming. I dont think above change will do this.


You are right. Sorry.


----------



## treydx (Jan 4, 2006)

All those solutions look pretty complicated. If I understand your question correctly, will a simple script similar to this do the trick?


```
one
	two
	three

[URL=#]show/hide[/URL]
```
A couple of points to this: it's got to have the inline style. You can also change from "visibility" to "display" and it will readjust the page instead of leaving the big white space for it. "display" has "block" and "none" instead of "hidden & visibile"


----------



## Eriksrocks (Aug 7, 2005)

treydx said:


> All those solutions look pretty complicated. If I understand your question correctly, will a simple script similar to this do the trick?
> 
> 
> ```
> ...


That looks good - but I don't know too much about JavaScript.


----------

