View Single Post
Old 10-02-2008, 06:22 PM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I have coded the following for you. With this HTML code:

html4strict Code:
<body onload="TalkPHP_Dropdown_Select.init();">

    <select name="page" id="page">
        <option>Choose one...</option>
        <option value="auth_level.php">Change auth level</option>
        <option value="email_settings.php">Email activation settings</option>
    </select>

</body>

And the following JavaScript code as well:

javascript Code:
<script type="text/javascript">

    var TalkPHP_Dropdown_Select =
    {
        init: function()
        {
            TalkPHP_Dropdown_Select.Address = 'http://www.talkphp.com/';
            TalkPHP_Dropdown_Select.Target = document.getElementById('page');
            TalkPHP_Dropdown_Select.Target.onchange = function()
            {
                TalkPHP_Dropdown_Select.gotoAddress();
            }
        },
       
        gotoAddress: function()
        {
            var pTarget = TalkPHP_Dropdown_Select.Target;
            var szValue = pTarget.options[pTarget.selectedIndex].getAttribute('value');
           
            if (szValue == null)
            {
                return;
            }
           
            location.href = TalkPHP_Dropdown_Select.Address + szValue;
        }
    }

</script>

It should produce something similar to what you're after. I hope it helps!
Attached Files
File Type: html dropdown.html (1.0 KB, 498 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
h0ly lag (10-03-2008)