473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Disabling a table

With a JS [javascript] dynamically created table

elt = document.createElement("table");
// Statements filling in the table.
document.body.appendChild(elt);

I'd like to do the equivalent of

elt.disabled = true;

and to be able to easily undo it. I'd like the table to go
gray, and to not respond to onClick nor onMouseOver.

What is some elegant JS+CSS way to do this? I had thought
perhaps of changing a CSS-class assigned to the table,
but I don't see how this will work, since individual <td>
cells have had explicit "onclick=" values assigned.

The only _general_ method I've been able to think of is to

.cloneNode(true)

the entire table [will this copy all the HTML attributes?
All the CSS values?]

and store it in a JS variable, then iterate over all the
nodes of the original table, and clear all "onclick=" and
set all colors to gray.

--gentsquash, Mathematics dept, Univ. of Florida
PS: I would like the method to work under
Firefox on MacOS, at a minimum.
Jun 1 '08 #1
1 1332
Sun, 1 Jun 2008 11:46:04 -0700 (PDT), /ge********@gmail.com/:
With a JS [javascript] dynamically created table

elt = document.createElement("table");
// Statements filling in the table.
document.body.appendChild(elt);

I'd like to do the equivalent of

elt.disabled = true;

and to be able to easily undo it. I'd like the table to go
gray, and to not respond to onClick nor onMouseOver.

What is some elegant JS+CSS way to do this? I had thought
perhaps of changing a CSS-class assigned to the table,
but I don't see how this will work, since individual <td>
cells have had explicit "onclick=" values assigned.
Assign a class (say "disabled") to the table which will enable to
style it appropriately and make your cell 'click' handler(s) check
whether the table has the class applied. Am I missing something
obvious?

--
Stanimir
Jun 1 '08 #2

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

Similar topics

5
by: Ghulam Farid | last post by:
Hi i have a table with primary key defined on col1 and col2. now i want to have col3 also included in primary key. when i alter the table it gives me error for duplicate rows. there is an option...
1
by: keni | last post by:
One method of disabling Design View is to create an MDE database. Without going into details, this won't work in my situation. What I need is just a snippet of VBA code that will disable the...
3
by: PB | last post by:
What is the rationalle for disabling JavaScript. AFAIK, the primary reason is for "security purposes" - but what specific kind of threats does the protect against? AND - is the disabling of...
3
by: David Parker | last post by:
I would like to be able to truncate all of the tables in a schema without worrying about FK constraints. I tried issuing a "SET CONSTRAINTS ALL DEFERRED" before truncating, but I still get constraint...
12
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
1
by: cvijaykrishna | last post by:
hi i have so many checkboxes inside a table can i disable all the checkboxes at once by disabling the table or is there any alternative (i have to use javascript becoz i need to do it in client...
2
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
HI I want to disable the underline of a hyperlink text in a hyperlink column of datagrid/gridview in the content page. If I am writing a css class to disable it in the master page then its...
1
by: hello2008 | last post by:
Hi, I have just started coding in PHP. I have coded a web page using HTML, JS, and PHP. An HTML table has to be populated dynamically using the data from the backend. Presently I have 5...
1
by: arggg | last post by:
I created a submit form that calls a javascript:AjAX Command that will call the data and submit it without have the page refresh. This works perfect in Firefox however in IE and Opera when the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.