Title in Select

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Venkat

    Title in Select

    Hi,

    I have got this html, javascript code

    <html>
    <head>
    function get()
    {
    alert(document. form1.xyz.value );
    alert(document. form1.xyz.title );
    return true;
    }
    </head>
    <body>
    <form method="get" name="form1" id=form1>
    <table>
    <tr>
    <td><select id=xyz name=xyz onChange="javas cript:get();">
    <option value="-1">------ select a name-------</option>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    The first alert statement will print the value -1, i need to know if the 2nd
    alert statement
    will print "-------select a name---------"?
    Is there anything like title property exists, if so can you please correct
    me on how to use it.


    Your help is highly appreciated.


    Regards
    Venkat




  • Janwillem Borleffs

    #2
    Re: Title in Select


    "Venkat" <venkat_kp@yaho o.com> schreef in bericht
    news:1060283483 .906500@sj-nntpcache-5...[color=blue]
    >
    > The first alert statement will print the value -1, i need to know if the[/color]
    2nd[color=blue]
    > alert statement
    > will print "-------select a name---------"?
    > Is there anything like title property exists, if so can you please correct
    > me on how to use it.
    >[/color]

    alert(document. form1.xyz.text) ;


    JW




    Comment

    • Venkat

      #3
      Re: Title in Select

      "Janwillem Borleffs" <jwb@jwbfoto.de mon.nl> wrote in message
      news:3f32b642$0 $28884$1b62eedf @news.euronet.n l...[color=blue]
      >
      >
      > alert(document. form1.xyz.text) ;
      >
      >
      > JW
      >[/color]
      Jan thanks for a response but i am afraid this is not working, it gives me a
      value "undefined" .

      Venkat



      Comment

      • Grant Wagner

        #4
        Re: Title in Select

        Janwillem Borleffs wrote:
        [color=blue]
        > "Venkat" <venkat_kp@yaho o.com> schreef in bericht
        > news:1060283483 .906500@sj-nntpcache-5...[color=green]
        > >
        > > The first alert statement will print the value -1, i need to know if the[/color]
        > 2nd[color=green]
        > > alert statement
        > > will print "-------select a name---------"?
        > > Is there anything like title property exists, if so can you please correct
        > > me on how to use it.
        > >[/color]
        >
        > alert(document. form1.xyz.text) ;
        >
        > JW[/color]

        var theSelect = document.forms['form1'].xyz;
        alert(theSelect .options[theSelect.selec tedIndex].text);

        <url: http://jibbering.com/faq/#FAQ4_13 />

        --
        | Grant Wagner <gwagner@agrico reunited.com>

        * Client-side Javascript and Netscape 4 DOM Reference available at:
        *


        * Internet Explorer DOM Reference available at:
        *
        Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


        * Netscape 6/7 DOM Reference available at:
        * http://www.mozilla.org/docs/dom/domref/
        * Tips for upgrading JavaScript for Netscape 7 / Mozilla
        * http://www.mozilla.org/docs/web-deve...upgrade_2.html


        Comment

        Working...