JavaScript document.createElement() Alternative

I haven't blogged in a while because I have been so busy getting ready for the wedding and things with my new job at Boeing as well. Which is partially the reason why I am blogging about this. I working on a project that I would like to add dynamic type functions into. After learning about creating DOM objects dynamically, I realized that the createElement and setAttribute functions should have been combined to make it easier. 

I am by no means a Javascript guru so if anybody would like to explain the disadvantages to my function then please elaborate in the comments. The function I created is simply called createElement and it shouldn't interfere with the other one as the other is part of the document class. An example of how the function can be used is as follows:

var txtbox = createElement('input','name=myTextBox','type=text','value=Your Text Here');

which would return the following tag element:

<input name="MyTextBox" id="MyTextBox" type="text" value="Your Text Here">

Download the code using the download link below.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
HiKyle ,
An excellent function fullfill lot of requirment, I have just made a alteration in function instead of
items.length()&gt;1
it should be only
items&gt;1

Thanks and Regards,
Bharat
# Posted By Bharat | 8/7/08 2:57 AM
Good find Bharat. Thanks
# Posted By Kyle Hayes | 8/7/08 5:58 AM