Getting pull down form values

Results 1 to 2 of 2

Thread: Getting pull down form values

  1. #1
    Join Date
    Dec 1969

    Default Getting pull down form values

    All I am trying to do is the the selected value out of a drop down menu using the window object. It works great in IE, but always returns that the pull down menu is null while using NN. Any help is apprciated.<BR><BR>Here is the script:<BR><BR>function Update()<BR>{<BR> var sDB = window.document.PullDn.DataB.value<BR> var sPhase = window.document.PullDn.Phase.value<BR> var sProg = window.document.PullDn.Prgm.value<BR> var sBuild = window.document.PullDn.Bld.value<BR>

  2. #2
    Join Date
    Dec 1969

    Default Sigh...good old MSIE...

    ...misleads one as always.<BR><BR>It is *NOT* legitimate to do document.FormName.SelectName.value in any browser except MSIE. I don&#039;t know if MS has rammed that in as a new part of the spec, but I doubt it. <BR><BR>The main reason nobody else supports it is because it is braindead: If you have a &#060;SELECT ... MULTIPLE ...&#062; form field, then *WHAT IS* the value????<BR><BR>The *proper* way to do this is:<BR><BR>document.FormName.SelectName.options[ document.FormName.SelectName.selectedIndex ].value<BR><BR>Naturally, you can shorten the whole thing considerably (which I notice you didn&#039;t do in your code, so let&#039;s do it here):<BR><BR>function Update()<BR>{<BR>frm = window.document.PullDn; // I assume PullDn is the form name<BR>var sDB = frm.DataB.options[frm.DataB.selectedIndex].value;<BR>var sPhase = frm.Phase.options[frm.Phase.options.selectedIndex].value;<BR>var sProg = frm.Prgm.options[frm.Prgm.selectedIndex].value<BR>var sBuild = frm.Bld.options[frm.Bld.selectedIndex].value<BR>...<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts