Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Why does n't I get the selected value ?

Reply
Thread Tools

Why does n't I get the selected value ?

 
 
Jean Passe
Guest
Posts: n/a
 
      12-08-2005
Hi,

The following does not work (I get nothing in the input box) :

<html>
<head>
<script type="text/javascript" language=javascript">

function afficher()
{
var idselection=window.document.truc.ma_combo;
var indexselection=idselection.selectedIndex;
var selectionenclair =idselection.options[indexselection].value;
window.document.truc.sel.value=selectionenclair;

}

</script>
</head>
<body>
<form name="truc">
<select name="ma_combo" size=1>
<option value="one" selected>one
<option value="two">two
<option value="three">three
</select>
<br>
<input type="text" name="sel" value="" size=10>
<br>
<input type="button" value="Afficher" onClick="afficher(" ")">
</form>
</body>
</html>

Why ????

Thanks.


 
Reply With Quote
 
 
 
 
Lee
Guest
Posts: n/a
 
      12-08-2005
Jean Passe said:
>
>Hi,
>
>The following does not work (I get nothing in the input box) :
>
><html>
><head>
><script type="text/javascript" language=javascript">


You're missing a quote in the line above, and have two extra
quotes in the line below:

><input type="button" value="Afficher" onClick="afficher(" ")">


onclick="afficher()"

You cannot nest quotes within quotes in HTML.

 
Reply With Quote
 
 
 
 
Jean Passe
Guest
Posts: n/a
 
      12-08-2005
Hi,

>>You cannot nest quotes within quotes in HTML.


Thanks. It works fine now.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selected ListItem in DropDownList does not appear selected Nathan Sokalski ASP .Net Web Controls 0 10-05-2008 10:29 PM
Selected ListItem in DropDownList does not appear selected Nathan Sokalski ASP .Net 0 10-05-2008 10:29 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Pass a form value that is different from selected value Iceman HTML 1 01-07-2004 03:29 PM



Advertisments