Why does n't I get the selected value ?

Discussion in 'Javascript' started by Jean Passe, Dec 8, 2005.

  1. Jean Passe

    Jean Passe Guest

    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.
    Jean Passe, Dec 8, 2005
    #1
    1. Advertising

  2. Jean Passe

    Lee Guest

    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.
    Lee, Dec 8, 2005
    #2
    1. Advertising

  3. Jean Passe

    Jean Passe Guest

    Hi,

    >>You cannot nest quotes within quotes in HTML.


    Thanks. It works fine now.
    Jean Passe, Dec 8, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ashish Kanoongo
    Replies:
    1
    Views:
    614
    Vjekoslav Babic
    Feb 3, 2004
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    878
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,836
    Smokey Grindel
    Dec 2, 2006
  4. Nathan Sokalski
    Replies:
    0
    Views:
    606
    Nathan Sokalski
    Oct 5, 2008
  5. Nathan Sokalski

    Selected ListItem in DropDownList does not appear selected

    Nathan Sokalski, Oct 5, 2008, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    290
    Nathan Sokalski
    Oct 5, 2008
Loading...

Share This Page