www.webdeveloper.com
Results 1 to 3 of 3

Thread: dyanmic element name

  1. #1
    Join Date
    Feb 2004
    Posts
    31

    dyanmic element name

    Hi,


    I want to assign document.myForm.subsite0.selectedIndex = -1.
    Because subsite number is different, subsite0, subsite1,....

    So I created a Javescript function listed bellow:

    function addMe(subNum) {

    var myPath = 'document.myForm.subsite' + subNum + '.selectedIndex';
    myPath = -1;
    }


    As you know, it doesn't work. I need your suggestions.


    Thank you very much.


    Arguo

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    Code:
    function addMe(subNum) { 
      document.myForm["subsite" + subNum].selectedIndex = -1;
    }

  3. #3
    Join Date
    Feb 2004
    Posts
    31
    Hi Davis,

    It works well, and thank you so much.


    Arguo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles