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

impostare il valore della SELECT all'indice che contiene una certa parola

selezionare il valore di una SELECT sapendo il testo che deve avere tra le
sue opzioni

<select name="combo">
<option>nome</option>
<option>cognome</option>
<option>prova</option>
<option>forse</option>
</select>
come faccio a impostare il valore della SELECT all'indice che contiene la
parola FORSE
Jul 23 '05 #1
1 2695


SAN CAZIANO wrote:
selezionare il valore di una SELECT sapendo il testo che deve avere tra le
sue opzioni

<select name="combo">
<option>nome</option>
<option>cognome</option>
<option>prova</option>
<option>forse</option>
</select>
come faccio a impostare il valore della SELECT all'indice che contiene la
parola FORSE


I am guessing that you want to set the value of the option that has as
its text the string 'forse':

function findOptionByText (select, optionText) {
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].text == optionText) {
return select.options[i];
}
}
return null;
}

var option = findOptionByText(document.forms.formName.elements. combo,
'forse');
if (option) {
option.value = 'Kibology';
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

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

Similar topics

2
by: STB | last post by:
ciao a tutti... ci risono... devo migliorare delle performance di accesso ad una tabella... la tabella non ha indice primario, ne altri indici... sulla tabella ci accedo con select di questo...
1
by: Miguel Cañedo | last post by:
Hi: I'm testing with fireforx 1.0 on MdkLinux10.0 I can not figure out why am I getting this error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame ::...
4
by: Marcos Beccar Varela | last post by:
Hello to all, I have this form with a PrintDocument named prt_doc, theproblem is that when I invoke the prt_doc.print() it only prints the las page, and not multiple pages. I Also Have a Preview...
6
by: TC | last post by:
Hi. I write a program in c language that read a text file and extrapolate the word. for all word the program calculate the number of the times that word is present in the text. The problem is the...
3
by: TC | last post by:
I'm not a C programmer. This is a good C? how check the return value of getch or scanf? and how check for the \n at the end of the text read? FEOF do not return true if the file (text file) is...
4
by: dal.luc | last post by:
Hello, I've a problem : I want to check which element has been checked in a list of radiobuttons. ///////////////////////////////////// function numeroChk(liste) { var...
59
by: raashid bhatt | last post by:
why are GOTO's not used they just a simple JMP instructions what's bad about them
1
by: albies | last post by:
Ciao a tutti, sono nuovo. Ho il problema di recuperare dei campi di struts che si trovano in un iterate indicizzati in una function javascript. questo è il codice del mio iterate: ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.