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. Advertisements

  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. Advertisements

  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. Advertisements

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. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    710
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    1,363
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,825
    Smokey Grindel
    Dec 2, 2006
  4. Chad
    Replies:
    11
    Views:
    588
    Chris Dollin
    Jun 7, 2007
  5. Nathan Sokalski
    Replies:
    0
    Views:
    818
    Nathan Sokalski
    Oct 5, 2008
  6. Nathan Sokalski

    Selected ListItem in DropDownList does not appear selected

    Nathan Sokalski, Oct 5, 2008, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    441
    Nathan Sokalski
    Oct 5, 2008
  7. PerlFAQ Server
    Replies:
    0
    Views:
    763
    PerlFAQ Server
    Feb 11, 2011
  8. PerlFAQ Server
    Replies:
    0
    Views:
    721
    PerlFAQ Server
    Mar 9, 2011
Loading...