# Javascript drop down menu onclick go to URL



## scrubbicus (Jan 23, 2009)

I found a script that apparently worked but for some reason it only works on one page. I have the Javascript in the index.php (between ) and all my pages are included into the content section so every page receives the same treatment but for some reason it only works on one page.

Does anyone have a script that can do this? I'm looking for something simple that I can have a drop down menu with and each option, when selected, will go to a URL. It'll be an action drop down menu so each option will be something like delete, move to trash, make unread and such.

If anyone can help me out that would be great. Here's my current javascript.


----------



## amanxman (Mar 28, 2006)

Hey,

Very simple onclick, go to xxxx js:


```
<div class="xxxx" onclick="GoTo('url.html')">
```
And then you need to call a js file, with the following:


```
// GoTo fuction
function GoTo(url)
{
	window.location.href = url;
}
```
Not sure if that's exactly the kind of thing you need - but it might be -- for your drop down, you'll be able to assign the onclick to whatever elements make up your drop down, be it <divs> or [*] or whatever

Hope it helps


----------



## scrubbicus (Jan 23, 2009)

Awesome thanks.

That is really easy.


----------

