Creating a html drop-down list dynamically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gurry

    Creating a html drop-down list dynamically

    Hi there

    I would like to write a javascript function that creates a drop-down
    list dynamically. I read on the docs that most HTML controls can not
    be created on run-time. what kind of work-arounds do you use in this
    case? maybe DHTML?
    do you have any example ?
    Javascript allows you to create the options of the drop-down list
    dynamically but not the drop-down list itself, I believe.
    Actually the same question goes for any other HTML control.

    any reference, example, link, suggestion greatly appretiated.

    Thanks a lot

    Gurry
  • kaeli

    #2
    Re: Creating a html drop-down list dynamically

    In article <1a639fb8.03121 80801.7f9acdfd@ posting.google. com>,
    jfeu@cisco.com enlightened us with...[color=blue]
    > Hi there
    >
    > I would like to write a javascript function that creates a drop-down
    > list dynamically. I read on the docs that most HTML controls can not
    > be created on run-time. what kind of work-arounds do you use in this
    > case? maybe DHTML?
    > do you have any example ?
    > Javascript allows you to create the options of the drop-down list
    > dynamically but not the drop-down list itself, I believe.
    > Actually the same question goes for any other HTML control.
    >
    > any reference, example, link, suggestion greatly appretiated.
    >[/color]

    Sure you can, for modern browsers that support createElement.
    Gain technical skills through documentation and training, earn certifications and connect with the community

    element.asp

    For full dhtml reference for IE, see

    url=/workshop/author/dhtml/reference/methods.asp

    Note that not all browsers support createElement or all of MSIE DHTML.
    For the second most popular browser, see NN/Mozilla docs here.


    --
    --
    ~kaeli~
    A man's home is his castle..., in a manor of speaking.



    Comment

    • Michael Winter

      #3
      Re: Creating a html drop-down list dynamically

      kaeli wrote on 18 Dec 2003 at Thu, 18 Dec 2003 16:10:37 GMT:
      [color=blue]
      > Sure you can, for modern browsers that support createElement.
      > http://msdn.microsoft.com/workshop/a...erence/methods
      > /create element.asp[/color]

      The createElement method is actually part of W3C's DOM
      specification. Modern versions of all browsers that support DOM,
      including IE, Mozilla, Netscape and Opera, should implement
      document.create Element().

      Mike

      --
      Michael Winter
      M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk")

      Comment

      • Richard Cornford

        #4
        Re: Creating a html drop-down list dynamically

        "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
        news:Xns9455EDB 42A0FDMWinterBl ueyonder@193.38 .113.46...
        <snip>[color=blue][color=green]
        >>Sure you can, for modern browsers that support createElement.
        >>http://msdn.microsoft.com/workshop/a...tml/reference/
        >>methods/create element.asp[/color]
        >
        >The createElement method is actually part of W3C's DOM
        >specificatio n. Modern versions of all browsers that
        >support DOM, including IE, Mozilla, Netscape and Opera,
        >should implement document.create Element().[/color]

        A problem arises with less dynamic browsers, they can reasonably
        implement the official DOM structure (childNodes, parentNode and so on)
        convenience properties and element/collection retrieval methods making
        access and navigation of a standardised DOM practical but if they are
        not dynamic enough to reflect changes in the DOM structure into changes
        in the displayed page it might reasonably be argued that not
        implementing createElement, replaceChild and so on is a good way of
        advertising the limited capabilities of the browser to the script
        author. These days the less dynamic browsers tend to be found on
        smaller devices but the modern ones do seem to go as far as practical
        towards implementing the W3C DOM, they just don't include the more
        dynamic methods.

        Richard.


        Comment

        • kaeli

          #5
          Re: Creating a html drop-down list dynamically

          In article <Xns9455EDB42A0 FDMWinterBlueyo nder@193.38.113 .46>,
          M.Winter@blueyo nder.co.invalid enlightened us with...[color=blue]
          > kaeli wrote on 18 Dec 2003 at Thu, 18 Dec 2003 16:10:37 GMT:
          >[color=green]
          > > Sure you can, for modern browsers that support createElement.
          > > http://msdn.microsoft.com/workshop/a...erence/methods
          > > /create element.asp[/color]
          >
          > The createElement method is actually part of W3C's DOM
          > specification. Modern versions of all browsers that support DOM,
          > including IE, Mozilla, Netscape and Opera, should implement
          > document.create Element().
          >[/color]

          I know. If you pointed that out because of the link to MS, I linked
          there because I like the docs. The MS docs are my fav source of info for
          the "new" kinds of DHTML because they have rather nice examples and the
          properties and methods are easy to find. It's searchable, too.

          If anyone has Mozilla/Netscape docs set up this nice, I'd love a link.
          The source I have does the job as far as making sure something works in
          NN, but isn't nearly as nice as the MS site.

          --
          --
          ~kaeli~
          Do cemetery workers prefer the graveyard shift?



          Comment

          Working...