473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

createElement?

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

var sel = document.create Element('SELECT ');

I have seen it used like this:

opt = document.create Element('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.create Element("LI");b ut what is
"LI"? Where do I need to look to find valid arguments for createElement??
Jul 23 '05 #1
1 1608
JS wrote:
<snip>
... Can I use this
method to create a new Drop/down list, like:

var sel = document.create Element('SELECT ');
Yes.

<snip> Are there any restrictions for which arguments
createElement can be called with?
Yes.
I have seen: var oNewNode =
document.create Element("LI");b ut 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.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
5200
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to calculate the totals in each row. when i try however, i receive the error: "Error: 'elements' is null or not an object"
2
42873
by: kie | last post by:
hello, when i create elements and want to assign events to them, i have realised that if the function assigned to that element has no parameters, then the parent node values can be attained. e.g. aTextBox=document.createElement('input'); aTextBox.onchange=calculateOneRow2;
1
21730
by: Weston C | last post by:
After noticing some problems with a script, I tried testing various bits in the squarefree javascript shell ( http://www.squarefree.com/shell/shell.html ) and noticed this: var anchor = document.createElement("a"); anchor undefined but:
4
4285
by: sg_maat | last post by:
I have a little problem with createElement(and msie). I was experimenting a bit with createElement and made the following script: <script> var tmp = document.createElement("div"); tmp.setAttribute("name", "tmpdiv2"); tmp.setAttribute("id", "calendar"); var image = document.createElement("img"); image.setAttribute("src", "img/ok.gif");
3
2201
by: Arpan | last post by:
Using DOM, this is how I am appending data to an existing XML file which is named AppendData.xml (the root element of AppendData.xml is <ProductList>): <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Dim xmlDoc As New XmlDocument() xmlDoc.Load(Server.MapPath("AppendData.xml")) Dim eltProducts1 As XmlElement = xmlDoc.CreateElement("Products")
9
1789
by: Andrew Poulos | last post by:
When I run the following code in FF 1.5 and 2, and IE 6 on my computer the table and image appears. When I run it on the client's XP machine it appears under FF 1.5 but under IE 6 the window is blank but IE appears to be in some sort of loop (after about 10 seconds I get the 'not responding' message in the title bar and have to close IE). What is it that causes it to behave differently on different computers? var t =...
3
4014
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table with a createElement function to add additional entries. The table has the first row of input text boxes already in it. You have to click a button to add another row. That seems to be working fine. How do I pull the information from the input boxes...
7
2527
by: Tarik Monem | last post by:
Why am I having so much trouble with using DOM in IE & Opera to create, then remove an Object & Embedded element? Here's the code that works in Firefox (Mac/Win/Linux) and Safari, but not on IE or Opera: var myfl_div = document.createElement('myfldiv'); myfl_div.setAttribute('style','position:absolute; left:100px; top:200px; width:960px; height: 560px; background-color: transparent;z-index: 5;'); function myFl_obj_emb() {
23
6637
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to use it? IE5 or IE6? Thanks
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.