Hello,
I've done some searching around the post, and I have found quite a bit of information related to the setAttribute and it's related uses. My problem lies in the usage of colspanning in dynamic table creation.
Code Snippet - <SCRIPT LANGUAGE="JavaScript">
-
function morecase(id){
-
var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0];
-
var row1=document.createElement('TR');
-
var row1td1=document.createElement('TD');
-
row1td1.appendChild(document.createTextNode('Incident: '));
-
var row1td2=document.createElement('TD');
-
row1td2.appendChild(document.createElement('INPUT'));
-
row1td2.setAttribute('TYPE','text','NAME','incident');
-
var row2=document.createElement('TR');
-
var row2td1=document.createElement('TD');
-
row2td1.appendChild(document.createTextNode('Blah blah blah blah blah blah blah'));
-
row2td1.setAttribute('colspan','2');
-
row1.appendChild(row1td1);
-
row1.appendChild(row1td2);
-
row2.appendChild(row2td1);
-
tbody.appendChild(row1);
-
tbody.appendChild(row2);
-
}
-
</script>
-
Everything works, but the COLSPAN does not process.
I can pass other commands to the TD (width, bgcolor, etc.) and they work fine, COLSPAN is just my headache.
Any help would be greatly appreciated!
William
POST NUMBER 1 Woo! :rolleyes:
8 23345
How did you fix it?
Hello,
I've done some searching around the post, and I have found quite a bit of information related to the setAttribute and it's related uses. My problem lies in the usage of colspanning in dynamic table creation.
Code Snippet
<SCRIPT LANGUAGE="JavaScript">
function morecase(id){
var tbody = document.getElementById(id).getElementsByTagName(" TBODY")[0];
var row1=document.createElement('TR');
var row1td1=document.createElement('TD');
row1td1.appendChild(document.createTextNode('Incid ent: '));
var row1td2=document.createElement('TD');
row1td2.appendChild(document.createElement('INPUT' ));
row1td2.setAttribute('TYPE','text','NAME','inciden t');
var row2=document.createElement('TR');
var row2td1=document.createElement('TD');
row2td1.appendChild(document.createTextNode('Blah blah blah blah blah blah blah'));
row2td1.setAttribute('colspan','2');
row1.appendChild(row1td1);
row1.appendChild(row1td2);
row2.appendChild(row2td1);
tbody.appendChild(row1);
tbody.appendChild(row2);
}
</script>
Everything works, but the COLSPAN does not process.
I can pass other commands to the TD (width, bgcolor, etc.) and they work fine, COLSPAN is just my headache.
Any help would be greatly appreciated!
William
POST NUMBER 1 Woo! :rolleyes:
Not very polite to say you fixed it and not to explain HOW, don't you think?
Anyway, colspan is actually spelled colSpan! It is a "casing" problem.
- tr1 = document.createElement('tr');
-
tbody1.appendChild(tr1);
-
td1 = document.createElemen("td");
-
tr1.appendChild(td1);
-
td1.setAttribute("colSpan",2);
-
//ok
Another solution:
var td = document.createElement('td');
td.colSpan = 5; // for example
It is really working, but it is not becoming a static table row.
How should i make it as a static one?
By static, do you mean fixed width? Post your code.
Another solution:
var td = document.createElement('td');
td.colSpan = 5; // for example
colSpan .. eso ers muchas gracias !!!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tom |
last post by:
I would like to know if an .asp case statement can contain HTML elements. I
am building an application that I would like to have dynamic choices. The
dynamic part would be built in the a case...
|
by: yurps |
last post by:
Hello here is my html, if you click the missing image in the first
column on the left, the div is shown, when clicked again the div
disappears...but the bottom border disappears as well...Is there...
|
by: The_Original_MB |
last post by:
I have a task to create tables dynamically, using the javascript DOM.
The current method uses a 1px x 1px IFRAME to loop through some data
generation stuff, and then call JS functions in the parent...
|
by: Dave Williamson |
last post by:
When a ASPX page is created with dynamic controls based on what the
user is doing the programmer must recreate the dynamic controls again
on PostBack in the Page_Load so that it's events are wired...
|
by: nsvmani |
last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link
I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It...
|
by: Eniac |
last post by:
Hi,
I've been working on a custom user control that needs to be modified
and the validation is causing me headaches.
The control used to generate a table of 4 rows x 7 columns to display
all...
|
by: bmallett |
last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
|
by: skyson2ye |
last post by:
Hi, guys:
I have written a piece of code which utilizes Javascript in PHP to create a three level dynamic list box(Country, States/Province, Market). However, I have encountered a strange problem,...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| | |