Correct way to blank a text value in an array?

Discussion in 'Javascript' started by Sam Wuebben, Feb 3, 2004.

  1. Sam Wuebben

    Sam Wuebben Guest

    What is the correct way of setting a text item in an array to be a
    blank so that IE for XP will display it as a blank?

    I have an array of 12 text items. Sometimes one of the vaules needs to
    be set to and display as a blank.
    The array is initially set up as 12 items and with some being set as
    blank spaces:

    myarray=new Array('one','two','three','fourth item','fifth
    item','sixth item','','','','','','');

    document.write(myarray[3]);

    displays the phrase fourth item

    and

    document.write(myarray[8]);

    gives a blank, even in IE for XP.

    However:

    If I try to set the fourth item to be a blank using

    myarray[3] = ''; //two single quotes. two double-quotes gives the
    same results

    and try to display myaray[3] using:

    document.write(myarray[3]);

    in IE for XP I keep getting a null.

    And the others values in the array after it are undefined. It is as if
    when you set an array item to be '' (two single quotes) then IE for
    windows erases that part of the array.

    All other browsers give a blank space and the array stays intact.

    I've tried everything and looked everywhere.

    So, what is the correct way of setting a text item in an array to be a
    blank so that IE for XP will display the blank?
     
    Sam Wuebben, Feb 3, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kai
    Replies:
    1
    Views:
    282
    Larry Bates
    May 5, 2006
  2. Dew
    Replies:
    7
    Views:
    360
  3. radishcarrot
    Replies:
    2
    Views:
    369
  4. Tom
    Replies:
    2
    Views:
    418
  5. Emmett Power

    Array with blank value

    Emmett Power, May 13, 2004, in forum: ASP General
    Replies:
    3
    Views:
    104
    Bob Barrows [MVP]
    May 13, 2004
Loading...

Share This Page