www.webdeveloper.com
Results 1 to 5 of 5

Thread: new Option('display','value') not showing markup

  1. #1
    Join Date
    Jun 2006
    Posts
    37

    new Option('display','value') not showing markup

    I have a webpage that needs to display a unique set of options in a dropdown based upon the country a user selects in another area of the page. The dropdown needs to be dynamic. I am using the following (in part) to load the select with options:

    selbox.options[selbox.options.length] = new Option('UPS Worldwide Express(sm)','07');

    I would like to replace the (sm) in the above with the ISO-8859-1 charset value of & # 8480 ;

    The problem is that the ISO-8859-1 characters do not display as the superscripted Service Mark <sup>sm</sup>

    I'm somewhat new to javascript and was thinking that there might be a way of concatenating to get it to work but have yet to discover how despite Googling and searching this forum. Any ideas?
    Thank you,
    Rich

  2. #2
    Join Date
    Feb 2006
    Location
    Where I live, people get shot. I need to move.
    Posts
    634
    got any code?

  3. #3
    Join Date
    Jun 2006
    Posts
    37
    I use a swich statement to find the country. An example for Puerto Rico is below

    case "PR":
    selbox.options[selbox.options.length] = new Option('UPS Ground','03');
    selbox.options[selbox.options.length] = new Option('UPS Next Day Air ' ,'01');
    selbox.options[selbox.options.length] = new Option('UPS Next Day Air Early A.M. ','14');
    selbox.options[selbox.options.length] = new Option('UPS Second Day Air ','02');
    selbox.options[selbox.options.length] = new Option('UPS Worldwide Express(sm)','07');
    selbox.options[selbox.options.length] = new Option('UPS Worldwide Express Plus(sm)','54');
    selbox.options[selbox.options.length] = new Option('UPS Worldwide Expedited(sm)','08');
    for(var i = 0; i < selbox.options.length; i++)
    {
    if (selbox.options[i].value == chosenval)
    selbox.options[i].selected=true;
    }
    break;


    the (sm) is what I'd like to have replaced by a supersecripted Service Mark. The question I have involves concatenation in JavaScript. I'm guessing that 'new option' creates and option object in the DOM and that interpretation of these codes can't take place inside these objects at creation time...??
    Thanks for the reply!

  4. #4
    Join Date
    Mar 2005
    Posts
    767
    ISO-8859-1 does not contain the service mark. But anyway, try
    Code:
    new Option('UPS Worldwide Express(\u2120)','07');

  5. #5
    Join Date
    Jun 2006
    Posts
    37
    So much for googling. Thanks though! That works!

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