473,386 Members | 1,763 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,386 software developers and data experts.

How can select shows none

Hello,
<%@ Language=VBScript %>
<%
Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"
%>
When open this page,select1 shows "One".I want when open the page,select1
shows none.That is to say,nothing is displayed in select1.
Thank you

Jul 19 '05 #1
11 1695
<%
Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"
%>
"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello,
<%@ Language=VBScript %>
<%
Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"
%>
When open this page,select1 shows "One".I want when open the page,select1
shows none.That is to say,nothing is displayed in select1.
Thank you

Jul 19 '05 #2
Sorry meant to say

Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value="""" SELECTED></OPTION>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"

"Alex Goodey" <ag*****@hsfinancial.co.uk> wrote in message
news:bv************@ID-221525.news.uni-berlin.de...
<%
Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"
%>
"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello,
<%@ Language=VBScript %>
<%
Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"
%>
When open this page,select1 shows "One".I want when open the page,select1 shows none.That is to say,nothing is displayed in select1.
Thank you


Jul 19 '05 #3
Just be careful when you are proccessing the response that they have
selected an actual value, rather than the blank one.

If you include the following javascript function within the <head></head>
section, and call it from the form as shown, Javascript will check for a
selection before allowing the form to submit. Note that, if Javascript is
disabled, this won't work, so you MUST also check server-side.

javascript:
function CheckForm(objForm){
if(objForm.select1.selectedIndex == 0){
alert("You must select an option from the select box.");
return false;}
}

HTML:
<form onSubmit="return CheckForm(this);">

Hope this helps - note that its after midnight here, I'm tired and I wrote
the script off the top of my head and haven't checked it - it *should* work
but I take no responsibility...

Blair
Alex Goodey <ag*****@hsfinancial.co.uk> wrote in article
<bv************@ID-221525.news.uni-berlin.de>...
Sorry meant to say

Response.Write "<SELECT id=select1 name=select1>"
Response.Write "<OPTION value="""" SELECTED></OPTION>"
Response.Write "<OPTION value=1>One</OPTION>"
Response.Write "<OPTION value=2>Two</OPTION>"
Response.Write "<OPTION value=3>Three</OPTION>"
Response.Write "</SELECT>"

Jul 19 '05 #4
Thank you,but
I want none can't be selected.That is to say the value which can be selected
is only "One","Two" or "Three".
I wait anyone's help

Jul 19 '05 #5
As far as I am aware, that cannot be done. Try the way I suggested before.

Blair

Jack <si*****************@noyahoo.co.jp> wrote in article
<Oi**************@TK2MSFTNGP09.phx.gbl>...
Thank you,but
I want none can't be selected.That is to say the value which can be selected is only "One","Two" or "Three".
I wait anyone's help

Jul 19 '05 #6
"Jack" wrote:

Thank you, but I want none can't be selected.
That is to say the value which can be selected
is only "One","Two" or "Three".


Such a thing is implementation-specific. You might be able to find such a
solution for a small range of browser/OS combinations, but you will have no
guarantee of forward compliance. Consider this, from the HTML 4 spec:

"Visual user agents are not required to present a SELECT
element as a list box; they may use any other mechanism,
such as a drop-down menu."
http://www.w3.org/TR/html401/interac...ml#edef-SELECT

The spec merely requires that the SELECT element creates a "menu". It leaves
the details to the implementation.

What exactly are you trying to accomplish? There is certainly a simpler
solution.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #7
Use radio buttons.

Ray at home

"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Thank you,but
I want none can't be selected.That is to say the value which can be selected is only "One","Two" or "Three".
I wait anyone's help

Jul 19 '05 #8
Sorry, what's means "Use radio buttons"?
Thank you

Jul 19 '05 #9
"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:ez**************@TK2MSFTNGP09.phx.gbl...
Sorry, what's means "Use radio buttons"?
Thank you


He means, instead of a select, use something like this:

<input type="radio" name="select1" value="1">One
<input type="radio" name="select1" value="2">Two
<input type="radio" name="select1" value="3">Three

Regards,
Peter Foti
Jul 19 '05 #10
Thank you

Jul 19 '05 #11
Yes, what Peter said. By using them, you can have NONE selected by default,
unlike what you can do with a select, but you'll then have no value, just
like if you had an empty leading spot in the select.

Ray at home

"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:ez**************@TK2MSFTNGP09.phx.gbl...
Sorry, what's means "Use radio buttons"?
Thank you

Jul 19 '05 #12

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

Similar topics

21
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All...
1
by: Amish | last post by:
Hi, I have CSS based popup menus which display over a select list. Everything works fine with Mozilla and Firefox but in IE the select list is always on top of the display block. The z-index as...
9
by: Prowler | last post by:
In our current application we have a page whose sole purpose for existence is to permit the user to select from a list (subsequent to our login page). We would like to have the list drop down...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
5
by: john | last post by:
In this single-user app I have a form with members. In the related table I have a field 'Select' with which the user can select a record. I have two buttons on the form (All and None) that select...
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
2
by: Tarik Monem | last post by:
OK! I've gone through a few tutorials and I cannot understand what I'm doing wrong casting_registration.php <table> <tr> <td> <form enctype="multipart/form-data" action="thankyou.php"...
1
by: RichardR | last post by:
I have a webpage which has a table that contains a column with several drop down boxes (<SELECT>). The contents of the drop down boxes are dynamically populated so I have no idea what the actually...
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.