createElement?

Discussion in 'Javascript' started by JS, May 27, 2005.

  1. JS

    JS Guest

    The document object has a method called createElement. Can I use this
    method to create a new Drop/down list, like:

    var sel = document.createElement('SELECT');



    I have seen it used like this:

    opt = document.createElement('OPTION');

    which means that opt now holds an option that can be appended to an already
    existing select object.
    Are there any restrictions for which arguments createElement can be called
    with? I have seen: var oNewNode = document.createElement("LI");but what is
    "LI"? Where do I need to look to find valid arguments for createElement??
     
    JS, May 27, 2005
    #1
    1. Advertising

  2. JS wrote:
    <snip>
    > ... Can I use this
    > method to create a new Drop/down list, like:
    >
    > var sel = document.createElement('SELECT');


    Yes.

    <snip>
    > Are there any restrictions for which arguments
    > createElement can be called with?


    Yes.

    > I have seen: var oNewNode =
    > document.createElement("LI");but what is "LI"?


    If you are not familiar with HTML there is not much point in attempting
    to script an HTML DOM.

    > Where do I need to
    > look to find valid arguments for createElement??


    The Core DOM applies to many document types. In general you can only
    create elements that make sense with the document type you are
    scripting. In an HTML DOM you create HTML elements so the HTML
    specification effectively lists those elements.

    Richard.
     
    Richard Cornford, May 27, 2005
    #2
    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. Arpan

    DOM CreateElement?

    Arpan, Aug 23, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    499
    Martin Honnen
    Aug 25, 2006
  2. Jeremy

    using createElement with VBScript

    Jeremy, Jul 23, 2003, in forum: ASP General
    Replies:
    1
    Views:
    613
    Ray at
    Jul 23, 2003
  3. kie
    Replies:
    25
    Views:
    294
  4. kie
    Replies:
    2
    Views:
    149
    Vjekoslav Begovic
    Sep 17, 2003
  5. Tormod Omholt-Jensen

    createElement applet and Opera 7

    Tormod Omholt-Jensen, Sep 18, 2003, in forum: Javascript
    Replies:
    1
    Views:
    124
    Laurent Bugnion, GalaSoft
    Sep 18, 2003
Loading...

Share This Page