Jump to content

change url via select box


brown2005

Recommended Posts

yeap, thats definitly javascript, but luckly ive got the code:
[code]
<select onchange="window.open(this.options[this.selectedIndex].value,'_top')">
<?php function select($page, $file){if ($page == $file) echo "selected=\"selected\"";}?>
<option value="page.php?results=1" <?php select($page, "1");?>>Inbox</option>
<option value="page.php?results=2" <?php select($page, "2");?>>Outbox</option>
</select>
[/code]
JavaScript:

Insert into the <head> of the page:
[code]
<script>
// Dropdown Redirect
function faqRedirect(selectBox)
{
var faqURL = selectBox.options[selectBox.selectedIndex].value
if (faqURL != "")
{
if (faqURL.substr(0, 4) != "http")
faqURL = "../" + faqURL

location.href = faqURL
}
}
</script>
[/code]


Insert into the body of the page:
[code]
<select onChange="faqRedirect(this)">
    <option>Please Select Your Choice</option>
    <option value="_____.php">01</option>
    <option value="_____.php">10</option>
    <option value="_____.php">100</option>
</select>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.