dynamic text with drop down..

Discussion in 'Javascript' started by ananttickoo@gmail.com, Dec 9, 2006.

  1. Guest

    i am trying to display text in which when i selet any option in drop
    down and click submit. text regarding that gets displayed below that
    drop down.

    i am able to display text but its next page.

    any can hep m ot
     
    , Dec 9, 2006
    #1
    1. Advertising

  2. ASM Guest

    a écrit :
    > i am trying to display text in which when i selet any option in drop
    > down and click submit. text regarding that gets displayed below that
    > drop down.
    >
    > i am able to display text but its next page.



    <form action="error_js.htm" onsubmit="return displayText();" name="f1">
    <select name="s1" ... >
    <opti ...
    </select>
    <p id="info">?</p>
    <input type=submit value="see">
    </form>

    JS :
    ====
    function displayText() {
    var S = document.forms['f1'].elements['s1'];
    var txt = S.options[S.selectedIndex].value;
    document.getElementById('info').innerHTML = txt;
    return false;
    }

    The onsubmit waits result of function displayText()
    which returns 'false'
    so form's action is avoid.

    If JS is disabled, the file 'error_js.htm' is displayed and explain JS
    must be enabled.
    (or you can have a php file which will do the job)

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
     
    ASM, Dec 9, 2006
    #2
    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. SirPoonga
    Replies:
    2
    Views:
    771
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,023
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    487
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    274
  5. Replies:
    3
    Views:
    291
Loading...

Share This Page