By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,814 Members | 2,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,814 IT Pros & Developers. It's quick & easy.

Creating a html drop-down list dynamically

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <1a**************************@posting.google.com >,
jf**@cisco.com enlightened us with...
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.


Sure you can, for modern browsers that support createElement.
http://msdn.microsoft.com/workshop/a...methods/create
element.asp

For full dhtml reference for IE, see
http://msdn.microsoft.com/library/default.asp?
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.
http://www.mozilla.org/docs/web-developer/

--
--
~kaeli~
A man's home is his castle..., in a manor of speaking.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2

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


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.createElement().

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #3

P: n/a
"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:Xn*******************************@193.38.113. 46...
<snip>
Sure you can, for modern browsers that support createElement.
http://msdn.microsoft.com/workshop/a...tml/reference/
methods/create element.asp


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.createElement().


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.
Jul 20 '05 #4

P: n/a
In article <Xn*******************************@193.38.113.46 >,
M.******@blueyonder.co.invalid enlightened us with...
kaeli wrote on 18 Dec 2003 at Thu, 18 Dec 2003 16:10:37 GMT:
Sure you can, for modern browsers that support createElement.
http://msdn.microsoft.com/workshop/a...erence/methods
/create element.asp


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.createElement().


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?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.