473,516 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Auto-select drop-down box

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!

Feb 10 '07 #1
3 2480
On Feb 10, 5:52 pm, bkane...@gmail.com wrote:
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

Feb 10 '07 #2
bk******@gmail.com wrote:
On Feb 10, 5:52 pm, bkane...@gmail.com wrote:
>>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) // perhaps?

Mick

>>{
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
Feb 10 '07 #3
bk******@gmail.com 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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
34287
by: Lew | last post by:
Hi all, I'm trying to create a page that has a user-selectable page auto-refresh option (IE 5.5). Essentially, it's a page that contains a checkbox, when the user checks the checkbox, I'd like the page to auto-refresh every 4 seconds....if the user un-checks the checkbox, I'd like to turn off the auto refresh. The page is as follows:
111
14256
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: <noscript> <meta http-equiv="refresh" content="1;url=http://yourURL/nojscript.html"> </noscript> This redirects to a doc which typically says "You...
9
4502
by: CW | last post by:
I wrote an HTML based chat application. The front end is built entirely on HTML + javascript. Essentially, I have a hidden frame that's refreshed frequently and any new messages are displayed in another frame using document.write. My problem is that since chat screen can be obscured by other applications/windows, I have no way of informing...
14
2048
by: Doug van Vianen | last post by:
Hi, I am trying to show a clipped part of a picture on a webpage and move it on the page and/or change the clipping to a different part of the picture. I show the picture in the body of the page by using <div id=div1 style="position:absolute; top:200; left:400; width:200; height:200; z-index:1; background-image:url(ole01.jpg);...
25
4254
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low cost way to do sophisticated debugging in IE6 other than to use the debugger described below, which is horribly documented otherwise. I feel...
5
2906
by: nivas.meda | last post by:
Hi, I have an excel sheet with a graph and cells.If i change the value in the excel cells the graph will reflect.Now i am going to implement this functionality in html page.I successfully saved this as interactive html page.Now my requirement changes a bit.The excell cells will not visible to others.i have a text box,If i change the value...
24
6288
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
7
2583
by: Anz | last post by:
Can any one know the javascript function to auto resize the swf when resizing its pop up window. I need to auto resize the swf when i resize my popup window in which the swf is displayed. Is there any javascript function available to perform this requirement ?
4
1964
by: Arun | last post by:
I came across a message sometime back in 2002. Here's a link: http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/f10e3748f6f260c5/b0b1ac5840e445e5?lnk=gst&q=color+picker#b0b1ac5840e445e5. The author tries to build a colour picker from scratch but his overuse of <tdtags puts me off the solution. Here is something I just...
5
2922
by: Nike1984 | last post by:
I'm fairly new to Javascript and it's more of a guessing game for me... I'm trying to build an app for Google Maps and just had some issues recently. First off I just wanted to say that everything works fine in FF and IE. It's Chrome I'm having issues with. I understand that Chrome is still somewhat in beta stages, so some bugs might occur....
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.