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 23396
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="JavaS cript">
function morecase(id){
var tbody = document.getEle mentById(id).ge tElementsByTagN ame("TBODY")[0];
var row1=document.c reateElement('T R');
var row1td1=documen t.createElement ('TD');
row1td1.appendC hild(document.c reateTextNode(' Incident: '));
var row1td2=documen t.createElement ('TD');
row1td2.appendC hild(document.c reateElement('I NPUT'));
row1td2.setAttr ibute('TYPE','t ext','NAME','in cident');
var row2=document.c reateElement('T R');
var row2td1=documen t.createElement ('TD');
row2td1.appendC hild(document.c reateTextNode(' Blah blah blah blah blah blah blah'));
row2td1.setAttr ibute('colspan' ,'2');
row1.appendChil d(row1td1);
row1.appendChil d(row1td2);
row2.appendChil d(row2td1);
tbody.appendChi ld(row1);
tbody.appendChi ld(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.create Element('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?
acoder 16,027
Recognized Expert Moderator MVP
By static, do you mean fixed width? Post your code.
Another solution:
var td = document.create Element('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 statment that will output based
upon the value of the option evaluated. This example only shows one case
statement but there are eight case statements.
Thanks for any insight!
Tom
If Not objRs.EOF Then
|
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 anyway
to stop this...???
<HTML>
<HEAD>
<title>Conform Inbox</title>
<meta content="False" name="vs_snapToGrid">
|
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 window to
generate the tables.
The basic idea is to add a table tag, with a thead and tbody, on the
main parent page, that has display:none set. This then becomes
display:block when there are rows to show. The rows themselves are
added...
|
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 and are
called like a static control.
Here is the problem that I need to solve. The processing overhead
that occurs to determine what dynamic controls need to be added
involves business logic and a query or queries of data in a sql server...
|
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 would be great , if i know how to create the dynamic HREF links like it should be getting different document based on each userid.
Here is my part of jsp code for your reference:
<%@ page...
| |
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 the days in the week with dates and textboxes to fill in some
data.
row 1: question
|
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 within options. I have everything being dynamically named from the previously dynamically named element. (I hope this makes sense.) I am not able to retrieve any of the dynamically created values. I can view them on the source page but can't pull them...
|
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, and I have spent three days trying to debug but to no avail.
Everything is OK when there are only two dependent list boxes, but when adding the third child list box, a problem appears: if I populate the third box only with the value: new...
|
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,...
|
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...
|
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,...
| |
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| | |