M
Monty
I use a SELECT dropdown as the nav interface for jumping to a chosen
page number. When I setup up the SELECT element on the page, I want to
show the user the current page number they are on, so, I put "selected"
next to the page number, as shown below:
-------------------------------
<form name="pick" method="post" action="showit.php">
<select name="pggo"
onChange="this.options[this.selectedIndex].selected;document.pick.submit();">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</form>
-------------------------------
The problem is that no matter what page number is chosen from the
dropdown, the passed value is always "2", because that's the "selected"
value above.
Is there any Javascript that I can add to the onChange statement above
that will change the 'selected' value from the current page number to
the one chosen by the user? I've tried a bunch of things, but, 2 is the
value that seems to always get passed. I'm not sure how to change the
selected value to the one chosen from the dropdown. Am I close with the
above code, or way off base?
Any help is much appreciated! I've spent about 4 hours searching and
trying to find out how to do this, but, nothing seems to work. Maybe
it's not possible?
Thanks.
page number. When I setup up the SELECT element on the page, I want to
show the user the current page number they are on, so, I put "selected"
next to the page number, as shown below:
-------------------------------
<form name="pick" method="post" action="showit.php">
<select name="pggo"
onChange="this.options[this.selectedIndex].selected;document.pick.submit();">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</form>
-------------------------------
The problem is that no matter what page number is chosen from the
dropdown, the passed value is always "2", because that's the "selected"
value above.
Is there any Javascript that I can add to the onChange statement above
that will change the 'selected' value from the current page number to
the one chosen by the user? I've tried a bunch of things, but, 2 is the
value that seems to always get passed. I'm not sure how to change the
selected value to the one chosen from the dropdown. Am I close with the
above code, or way off base?
Any help is much appreciated! I've spent about 4 hours searching and
trying to find out how to do this, but, nothing seems to work. Maybe
it's not possible?
Thanks.