Re: Drop down navigation...
by "Cyanide _7" <leo7278(at)hotmail.com>
|
Date: |
Fri, 18 Feb 2000 22:17:15 CST |
To: |
mwilson(at)sigmapath.com |
Cc: |
hwg-languages(at)hwg.org |
|
todo: View
Thread,
Original
|
|
> > 1) I have to confirm your choice (hitting return because there's not an
>OK
> > button)
>
i thought it was using the onChange event handler? this should not require
hitting return or clicking.
> > 2) I receive an error message in line 9, e.g.: http://www.yahoo.com is
>not
> > a number
this is a basic true statement ;o�
>
>I received the same error in my NN 3.04
>
> > You can correct these errors:
> > 1) add an OK button
if this corrects the problem, then it is a workaround and not a solution. i
don't see how this has anything to do with the named error above though.
>No can do! I am praying there is a way around this for NN 3.04! A "go"
>button doesn't fit into my design.
>
> > 2) change
> > if(menu.options[menu.selectedIndex].value != 0)
> > with
> > if(menu.options[menu.selectedIndex].value != "")
> > you need to check equality between strings and not between a string and
>a
> > number.
i was unaware that NN3.04 had a problem comparing different data types.
either way, ALL data returned from a form value is returned as a string. for
future reference, if you wanted to test against a specific number value
rather than a flag, you could use (menu.field.value != "0") or parse the
value as an int or float, etc... does anyone know at exactlly what point JS
began implicitly casting all kinds of data types?
>Now I have a new set of problems...
>In the previous version of the script I had the value of the "---choose
>a link---" option set to 0, which when selected, would keep the user on
>the current page and did not produce any errors. It would not be
>practical to hard code an URL for this option's value
the suggestion was to do this:
if(menu.options[menu.selectedIndex].value != "")
the empty string is a flag for invalid menu selections. you originally set
it to 0 but then we've exhausted the data type issue. by testing agaist an
empty string, you need to make that the value of the invalid menu option,
ie:
<OPTION VALUE="" SELECTED>---Choose a Link---</OPTION>
this may be what you want. good luck - Cyanide_7
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA