Faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 17 people (41%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I delete one Option in select box in IE ?

Aug 27th, 2009 15:46
khalid khalid, forum net tr, chat alarab, jsWalter, Guest, http://www.jr7sa.com


This is what I use... 
This is part of a more extensive coolection of functions and methods 
for the SELECT Object I've collected/created over the past few years. 
Walter 
 http://www.jr7sa.com
http://www.jr7sa.com/msn
http://www.jr7sa.com/vb
http://www.jr7sa.com/1
http://www.jr7sa.com/wordpress
http://www.jr7sa.com/nkt
http://www.jr7sa.com/chat
http://www.jr7sa.com/cam
http://www.jr7sa.com/newcaam
http://jr7sa.com/vb/f2.html
http://jr7sa.com/vb/f3.html
http://jr7sa.com/vb/f4.html
http://jr7sa.com/vb/f15.html
http://jr7sa.com/vb/f56.html
http://jr7sa.com/vb/f57.html
http://jr7sa.com/vb/f17.html
http://jr7sa.com/vb/f50.html
http://jr7sa.com/vb/f38.html
http://jr7sa.com/vb/f21.html
http://jr7sa.com/vb/f23.html
http://jr7sa.com/vb/f43.html
http://jr7sa.com/vb/f39.html
http://jr7sa.com/vb/f44.html
http://jr7sa.com/vb/f46.html
http://jr7sa.com/vb/f49.html
http://jr7sa.com/vb/f27.html
http://jr7sa.com/vb/f28.html
http://jr7sa.com/vb/f40.html
http://jr7sa.com/vb/f54.html
http://jr7sa.com/vb/cv_rss_feeds.php
http://www.jr7sa.com/vb/archive/index.php/
http://jr7sa.com/vb/f47.html
http://jr7sa.com/vb/f35.html
http://jr7sa.com/vb/external.php?type=RSS2
http://jr7sa.com/vb/jr7sa.com_vb_sitemap.xml
http://jr7sa.com/vb/sitemap.php
===================================== 
// {{{ _deleteOption() 
   /** 
    * Method private void _deleteOption( void ) 
    * 
    * New Method Member to the SELECT Form Object. 
    * This calls the public deleteOption() function. 
    * 
    * objSelectRef.deleteOption()  This will kill the selected item 
    * 
    * @name _deleteOption() 
    * @author Walter Torres <[email protected]> 
    * 
    * @category SELECT Object Extentions 
    * @uses deleteOption() 
    * 
    * @access private 
    * @since v1.0 
    * 
    * @param void 
    * @return void 
    * 
    */ 
    function _deleteOption() 
    { 
        deleteOption(this, this.selectedIndex); 
    }; 
// }}} 
// {{{ deleteOption() 
   /** 
    * Method public void deleteOption( object, int ) 
    * 
    * Delete given Item Index from given Select Object 
    * 
    * @name deleteOption 
    * @author Martin Webb <[email protected]> and Michel Plungjan 
<[email protected]> 
    * @copyright 1996-2001 irt.org, All Rights Reserved. 
    * @original http://developer.irt.org/script/916.htm 
    * 
    * @category SELECT Object Extentions 
    * 
    * @access public 
    * @since v1.0 
    * 
    * @param ref object Reference to Select Form Object 
    * @param int index Index of which Item to remove 
    * 
    */ 
    function deleteOption($objSelect, $intIndex) 
    { 
        // If $objSelect is a string, convert to Object Reference 
        // Then see if Object Reference exists 
        if ( ( typeof ( $objSelect ) ) == 'string' ) 
            $objSelect = document.getElementById($objSelect); 
        // If we have nothing to deal with, just bale... 
        if ( ( ! $objSelect ) ||               // Some browsers will 
define this 
             ( $objSelect == 'undefined' ) ||  // othes give this 
             ( $objSelect == '' ) ||           // Konqueror gives this 
             ( ! $intIndex ) )                 // Without an index, we 
have nothing to do 
            return; 
        $objSelect.options[$intIndex] = null; 
    }; 
// }}} 
// {{{ _deleteOptionAll() 
    function _deleteOptionAll() 
    { 
        // kill them all! 
        deleteOptionAll( this ); 
    }; 
// }}} 
// {{{ deleteOptionAll() 
    function deleteOptionAll( $objSelect ) 
    { 
        $objSelect.options.length = 0; 
    }; 
// }}} 
now "attach" these to the SELECT Object 
var $arySelectTags = document.getElementsByTagName("select"); 
    // Loop down all the SELECT Objects in this FORM and 
    // add new method members. 
    for (var $i = 0; $i < $arySelectTags.length ; $i++) 
    { 
       /** 
        * Insert Delete Selected Item 
        * 
        * @method public Deletes Selected Item 
        * @name deleteItem() 
        * @uses _deleteOption() 
        * 
        * @access public 
        * @since v1.4 
        */ 
        $arySelectTags[$i].deleteOption = _deleteOption; 
       /** 
        * Insert Delete All Options 
        * 
        * @method public Delete All Options 
        * @name deleteOptionAll() 
        * @uses _deleteOptionAll() 
        * 
        * @access public 
        * @since v1.4 
        */ 
        $arySelectTags[$i].deleteOptionAll = _deleteOptionAll 
    }   // for ... $arySelectTags.length
http://www.youtubevideolari.net youtube videos
online video tr tube http://www.videotrtube.com
full forum http://www.forumnettr.com/forum 
secilmis youtube videolari 
firmalar sirketler rehberi http://www.sirketfirmarehberi.com firma
sirket rehberi adres telefon bilgileri
full program full oyun http://www.forumnettr.com
f