HighDots Forums  

Setting the initial value of an HTML list

alt.html.tags alt.html.tags


Discuss Setting the initial value of an HTML list in the alt.html.tags forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Derek ( AT ) Blueyonder
 
Posts: n/a

Default Setting the initial value of an HTML list - 08-28-2009 , 10:28 AM






Hi

I have a list, similar to the one below, how do I get it to show a
particular value rather than always starting at 01?

I would like to be able to get it to show the current date number, i.e. on
the 15th of a month the list would show 15..

Any assistance would be appreciate.

Many thanks

Derek


<select name="selectday" id="selectday">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>

Reply With Quote
  #2  
Old   
John Hosking
 
Posts: n/a

Default Re: Setting the initial value of an HTML list - 08-30-2009 , 02:24 PM






On Fri, 28 Aug 2009 15:28:33 +0100, Derek @ Blueyonder wrote:

Quote:
I have a list, similar to the one below, how do I get it to show a
particular value rather than always starting at 01?
I believe you want the attribute "selected".

I believe you also want to know about HTMLDog, a great tutorial and
reference site for HTML (and CSS as well). Here's the page where I found
your answer: <http://www.htmldog.com/reference/htmltags/option/>

The canonical reference site is, of course, the W3C:

<http://www.w3.org/>
<http://www.w3.org/TR/html401/>
<http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1>

Quote:
I would like to be able to get it to show the current date number, i.e. on
the 15th of a month the list would show 15..
...
<option value="14">14</option>
<option value="15" selected>15</option>
<option value="16">16</option>
...

as at the W3C. The HTMLDog offers it as:

...
<option value="14">14</option>
<option value="15" selected="selected">15</option>
<option value="16">16</option>
...


The two forms are equivalent and valid, since selected is a boolean
attribute, and can be written in something called minimized form:
<http://www.w3.org/TR/html401/intro/sgmltut.html#didx-boolean_attribute-1>

You'll want to test in many browsers, as usual.


Quote:
select name="selectday" id="selectday"
option value="01">01</option
[rest snipped]
/select
Two more things:

If you had read this group before posting you might have noticed its low
article count. It's all but dead (or I am the undead). You might also look
at comp.infosystems.www.authoring.html (currently quiet as well, but with
more subscribers).

If you want to munge your e-mail address, you might do better to use a
clearly non-valid address, like <derekblakey (AT) blueyonder (DOT) co.uk.INVALID>.
Yours is possibly valid and some spammer might attempt to send mail to it,
causing servers to attempt delivery. No server is supposed to send or
forward mail (or HTTP requests) to an .invalid domain.
See <http://en.wikipedia.org/wiki/.invalid>

HTH

--
John

Reply With Quote
  #3  
Old   
Net5
 
Posts: n/a

Default Re: Setting the initial value of an HTML list - 09-10-2009 , 05:59 PM



On the 'option' you want as the default selected option, use this
form:

<option selected value="03" >03</option>


On Fri, 28 Aug 2009 15:28:33 +0100, "Derek @ Blueyonder"
<NOSPAMderekblakey (AT) NOSPAMblueyonder (DOT) co.uk> wrote:

Quote:
Hi

I have a list, similar to the one below, how do I get it to show a
particular value rather than always starting at 01?

I would like to be able to get it to show the current date number, i.e. on
the 15th of a month the list would show 15..

Any assistance would be appreciate.

Many thanks

Derek


select name="selectday" id="selectday"
option value="01">01</option
option value="02">02</option
option value="03">03</option
option value="04">04</option
option value="05">05</option
option value="06">06</option
option value="07">07</option
option value="08">08</option
option value="09">09</option
option value="10">10</option
option value="11">11</option
option value="12">12</option
option value="13">13</option
option value="14">14</option
option value="15">15</option
option value="16">16</option
option value="17">17</option
option value="18">18</option
option value="19">19</option
option value="20">20</option
option value="21">21</option
option value="22">22</option
option value="23">23</option
option value="24">24</option
option value="25">25</option
option value="26">26</option
option value="27">27</option
option value="28">28</option
option value="29">29</option
option value="30">30</option
option value="31">31</option
/select

Reply With Quote
  #4  
Old   
Derek ( AT ) Blueyonder
 
Posts: n/a

Default Re: Setting the initial value of an HTML list - 09-21-2009 , 02:19 PM



"Net5" <Pat (AT) NeT5 (DOT) cm> wrote

Quote:
On the 'option' you want as the default selected option, use this
form:

option selected value="03" >03</option


Thank you all, it know it has been a while since the answers were posted but
only just had time to get this sorted this afternoon.

Many thanks

Derek

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.