Javascript Auto-select drop-down box

B

bkaneweb

Hi,
I have a drop down box that jumps to a certain page number in a
catalog when you select it. The actual HTML page does not change, I
just change the ?page= at the end of the address to select the page. I
need to have the page in the drop-down box automatically selected to
the page that was just chosen after the page refreshes. I've tried :
<form>
<script>
if (x=y)
{
var selec= 'selected="selected"'
}
var y=window.location.search.substring(1)
for (var x=1; x<= 157; x++)
{
document.write('option ' + selec +'value="' + x + '">' + x + ' / ' + (x
+1) + 'option')
document.write('<option ' + selec +'value="' + x + '">' + x + ' / ' +
(x+1) + '</option>')

}</script>
</form>

but it does not work. Any suggestions? I need this answered ASAP.
Thanks for your help!
 
B

bkaneweb

Hi,
I have a drop down box that jumps to a certain page number in a
catalog when you select it. The actual HTML page does not change, I
just change the ?page= at the end of the address to select the page. I
need to have the page in the drop-down box automatically selected to
the page that was just chosen after the page refreshes. I've tried :
<form>
<script>
if (x=y)
{
var selec= 'selected="selected"'}

var y=window.location.search.substring(1)
for (var x=1; x<= 157; x++)
{
document.write('option ' + selec +'value="' + x + '">' + x + ' / ' + (x
+1) + 'option')
document.write('<option ' + selec +'value="' + x + '">' + x + ' / ' +
(x+1) + '</option>')

}</script>

</form>

but it does not work. Any suggestions? I need this answered ASAP.
Thanks for your help!

I just forgot to add:
"y" is the value of the ?page= on the page
 
R

Randy Webb

(e-mail address removed) said the following on 2/10/2007 5:52 PM:
Hi,
I have a drop down box that jumps to a certain page number in a
catalog when you select it. The actual HTML page does not change, I
just change the ?page= at the end of the address to select the page. I
need to have the page in the drop-down box automatically selected to
the page that was just chosen after the page refreshes. I've tried :
<form>
<script>
if (x=y)

if (x==y)

= doesn't compare, it sets a value.
== compares, but not specifically compares.
=== is a strict comparison.
but it does not work. Any suggestions? I need this answered ASAP.

What you need and what you get are two different things. In Usenet you
get an answer when you get it. If you want to dictate a time frame then
try paying for the otherwise free help you can get here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top