Here is the JavaScript function that I tested working with your problem:
function ResetDropDowns_EstateInfo()
{
lb = document.getElementById("lbAmenitiesSelected").options;
for(var i=lb.length-1;i>=0; i--)
lb.remove(i);
}
Ying
--- In [email protected], P P <[EMAIL PROTECTED]> wrote:
> Hi All
>
> I'm facing this strange problem in Javascript +
> ASP.NET, can somebody please tell me why the RESET is
> not working using Javascript.
>
> Here is the function (2 versions) which I call from
> javascript; I wanted the code to delete all the items
> from the list-box "lbAmenitiesSelected", but it does
> nothing, neither does it report any error.
>
> Code-1
> ======
> function ResetDropDowns_EstateInfo()
> {
> document.frmEstateInfo.lbAmenitiesSelected.Items.Clear();
>
> }
>
>
> Code-2
> ======
> function ResetDropDowns_EstateInfo()
> {
> for (h =
> document.frmEstateInfo.lbAmenitiesSelected.Items.Count-1;
> h >= 0; h--)
> {
>
> //document.frmEstateInfo.lbAmenitiesSelected.Items.RemoveAt(h);
>
> //document.frmEstateInfo.lbAmenitiesSelected.Items.removeItemAt(h);
>
>
//document.frmEstateInfo.lbAmenitiesSelected.Items.removeItemFromSelection
> (h);
>
> document.frmEstateInfo.lbAmenitiesSelected.deleteItem(h);
> }
> }
>
>
> Thanks in advance
> PP
>
>
>
> __________________________________
> Discover Yahoo!
> Get on-the-go sports scores, stock quotes, news and more. Check it out!
> http://discover.yahoo.com/mobile.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/