Jump to content

dropdown link


Russia

Recommended Posts

I would like this code to auto link after it is selected, that means when u choose an option in the dropdown it links you without having to click any buttons. It is for a pagination for the limit of how many to show on each page.

 

  <font color="black">Show per page</font>
    <select onchange="setLocation(this.value)">
            <option value="?limit=9">9</option>
            <option value="?limit=15">15</option>
            <option value="?limit=30">30</option>
            <option value="?limit=all">
            All        </option>
        </select> 

 

Link to comment
https://forums.phpfreaks.com/topic/180719-dropdown-link/
Share on other sites

Basically this:

 

<script language="JavaScript">
function loadPage(list) {
  location.href=list.options[list.selectedIndex].value
}
</script>


<form>
<select name="file" size="1"
  onchange="loadPage(this.form.elements[0])" target="_parent._top"
            <option value="?limit=9">9</option>
            <option value="?limit=15">15</option>
            <option value="?limit=30">30</option>
            <option value="?limit=all">All</option>
</select>
</form>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/180719-dropdown-link/#findComment-953622
Share on other sites

I think this is what you are looking for but you still didnt explain it any better you just said basically this with an example that still doesnt explain what you are trying to do. I assume you are trying to submit the page on change and pass the limit to the page so try this:

 

<form>
<select name="limit" size="1" onchange="this.form.submit();">
            <option value="9">9</option>
            <option value="15">15</option>
            <option value="30">30</option>
            <option value="all">All</option>
</select>
</form>

 

So basically that will submit this form and it will put a get variable in the url. so in this case the url will look like http://yourwebsite.com?limit=9 if you were to select the first option. is that what you were looking for?

Link to comment
https://forums.phpfreaks.com/topic/180719-dropdown-link/#findComment-953922
Share on other sites

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.