473,378 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

programmatically select an option in "select" box in html

Hi,

I'm having trouble selecting an option in html, i.e. i change the
code, but the change is not reflected in the browser.
Example, i have
<select>
<option>A
<option selected>B
</selected>

if I click A and refresh the page, the select box will still be in A,
even though according to the code should be pointed to B. I'm using
firefox. Any suggestion? thanks
Aug 13 '08 #1
1 2955
rvelosoo wrote:
I'm having trouble selecting an option in html, i.e. i change the
code, but the change is not reflected in the browser.
Example, i have
<select>
<option>A
<option selected>B
</selected>
if I click A and refresh the page, the select box will still be in A,
even though according to the code should be pointed to B. I'm using
firefox. Any suggestion? thanks
<body onLoad="document.forms[0].s.selectedIndex = 1;">
<form method="get" action="#">
<select name="s" size="1">
<option value="A">A</option>
<option value="B" selected>B</option>
</selected>
</form>
</body>

--
Bart
Aug 13 '08 #2

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

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
16
by: lkrubner | last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR, INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql? PostGre info would also be useful. I'm trying to...
2
by: caprice | last post by:
I'm a MySQL newbie. As I have to access MySQL database in Pocket PC, I'm developing a evc++ program to read and retrieve data from MySQL table. Where can I get some detail information about how...
2
by: Greg Ercolano | last post by:
I'm trying to make a SELECT form that contains monospaced text where the headings and columns in the text align. Here's the HTML I've been using that seems to work on all browsers /except/...
0
by: Michael | last post by:
I have a problem forcing files to download. If I select Save the document is saved with no problems. If I select "Open" the document is empty or I get a "File not found" error from the application...
1
by: DB_2 | last post by:
Greetings, I was searching Google for ways to turn off transaction logging for some queries. I came across this old post from Feb 2003: > From: fareeda (fareeda@pspl.co.in) > Subject: Re:...
2
by: google | last post by:
Hello everyone, I am having an issue using the "Multi Select" option in a list box in MS Access 2003. I am making a form that users can fill out to add an issue to the database. Each issue can...
2
by: Midgard | last post by:
Hi there, I have this codes: <select name="my_items"> <option value="bmw">My Car</option> <option value="audi">My Old Car</option> </select>
3
by: yawnmoth | last post by:
//form//input //form//select//option I can combine those with an or (|), but to make my code more concise, would it be possible to reuse the //form bit? Could I maybe do something like this,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.