I have the following scrollable table I have to implemet a functionality that I can select a row in it & display that data in popup window..
Any hints/example or similar available implementation? - http://www.imaputz.com/cssStuff/bigFourVersion.html#
Help
7 6159 acoder 16,027
Recognized Expert Moderator MVP
You could pass a reference of the table row to the function which handles the onclick event and use cells[] to retrieve the td values.
HI Mod, Thanks for reply but can you please provide a little example how can i do this ...how can I select a row and gets it value......
acoder 16,027
Recognized Expert Moderator MVP
Pass the id of the table row (assuming you have given ids to each row to the function: - onclick="doSomething('tr_id');"
then use the table row's cells array to get the data from the table data cells. If you don't want to do this inline, see the advanced event handling in this article.
Hi,
I have made a script that select Row of a HTML table ...
but problem is it is only working with th IE.... what I have to do to make it compatible with the Mozila Firefox..
Please help.... - function mouse_event_handler(e) {
-
e = e || window.event;
-
var cell = e.srcElement || e.target;
-
var tname = (cell.nodeType == 1) ? cell.tagName.toLowerCase() : '';
-
while(tname != "table" && tname !="td" && tname != "th"){
-
cell= cell.parentNode || cell.parentElement;
-
tname = cell.tagName.toLowerCase();
-
}
-
if (tname == "td" || tname == "th") {
-
var newClass;
-
var cellIdx = _getCellIndex(cell);
-
var row = cell.parentNode || cell.parentElement;
-
var rowIdx = _getRowIndex(row);
-
if (cellIdx == 0 && rowIdx == 0) {
-
clearHighlight();
-
}
-
else if (cellIdx == 0) {
-
_setRow();
-
}
-
else {
-
_setRow();
-
-
}
-
}
-
function _getTable() {
-
var tbleObj;
-
if (mouse_event_handler.previous.table)
-
return;
-
else {
-
tbleObj = row.parentNode || row.parentElement; //tbody
-
var tn = tbleObj.tagName.toLowerCase();
-
while (tn != "table" && tn != "html") {
-
tbleObj = tbleObj.parentNode || tbleObj.parentElement;
-
tn = tbleObj.tagName.toLowerCase();
-
}
-
mouse_event_handler.previous.table = tbleObj;
-
}
-
}//eof _getTable
-
function _clearHighlight() {
-
_clearRow();
-
mouse_event_handler.previous.row = null;
-
mouse_event_handler.previous.cellIdx = null;
-
}//eof clearHighlight
-
function _clearRow() {
-
if (mouse_event_handler.previous.row) {
-
mouse_event_handler.previous.row.className = "";
-
mouse_event_handler.previous.row.cells[0].className = "";
-
}
-
}//eof clearRow
-
function _setRow() {
-
_clearRow();
-
if (tname == 'td' || mouse_event_handler.previous.row != row) {
-
row.className = 'hlt';
-
row.cells[0].className = 'hlt';
-
mouse_event_handler.previous.row = row;
-
-
}
-
else {
-
mouse_event_handler.previous.row = null;
-
}
-
}//eof setRow
-
function _getCellIndex(cell) {
-
var rtrn = cell.cellIndex || 0;
-
-
if (rtrn == 0) {
-
do{
-
if (cell.nodeType == 1) rtrn++;
-
cell = cell.previousSibling;
-
} while (cell);
-
--rtrn;
-
}
-
return rtrn;
-
}//eof getCellIndex
-
function _getRowIndex(row) {
-
var rtrn = row.rowIndex || 0;
-
-
if (rtrn == 0) {
-
do{
-
if (row.nodeType == 1) rtrn++;
-
row = row.previousSibling;
-
} while (row);
-
--rtrn;
-
}
-
return rtrn;
-
}//eof getRowIndex
-
}//eof mouse_event
-
mouse_event_handler.previous = {cellIdx: null, row: null, table: null};
-
function addEvent(obj, event_name, fnc) {
-
-
if (typeof obj == "undefined")
-
return;
-
else if (obj.attachEvent)
-
obj.attachEvent("on"+event_name, fnc);
-
else if (obj.addEventListener && !browser.isKHTML)
-
obj.addEventListener(event_name, fnc, false);
-
else
-
obj["on" + event_name] = fnc;
-
-
}//eof addEvent
-
Regards,
BuntyIndia
acoder 16,027
Recognized Expert Moderator MVP
So what happens? Do you get any errors?
So what happens? Do you get any errors?
In Mozilla now it is working fine but in IE some time it give error in line 88 mouse_event_han dler.previous.r ow.cells.0 is null or not a object
Pleaes suggest what i do?
acoder 16,027
Recognized Expert Moderator MVP
Does this occur in _clearRow()?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Muralidhar |
last post by:
Hi,
I'm having a jsp page which is having a table and a div tag.The
heading such as a radio button,Name , Age etc. are fixed.Only the data
under it is scrolling. So i've set one table for header which are
fixed.
Then a div tag inside which there is a table which is used for
scrolling the data.When i select a radio i'm submitting the form.The
problem is here i'm able to set focus to the radio button, but i'm
unable to maintain the...
|
by: Matt Kruse |
last post by:
This is a typical layout, but I have specific requirements. I'm trying to
figure out a) if it's possible to meet the requirements and b) if so, how.
+---------------+
| header |
+---------------+
| body |
| (scrollable) |
+---------------+
| footer |
|
by: Adi |
last post by:
Hi,
I made a TBODY scrollable but I have a problem,
If there is a "Select" boxes in the table it puts the select boxes on
top of the Table head when scrolling.
Any idea if that can be fixed?
Thanks
|
by: Michael Schuerig |
last post by:
I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table where
the head row is fixed and the body columns below are scrollable (with
the ordinary scrollbars, no less). Whatever I try, the columns in the
head and the body aren't aligned; the widths are computed independently
which gives a completely ragged look.
Michael
--
|
by: david.joyce |
last post by:
I am aware that v7 Static Scrollable Cursors do not work with
pseudo-conversational CICS because of the temp work file being
destroyed but will v8 Dynamic Scrollable Cursors work with
pseudo-conversational CICS due to these cursors directly using the base
table?
| |
by: Keimo Repo |
last post by:
Hello
I would need some advice, even just speculations...
A customer of ours insists on a couple of customer specific design
features for our existing multi-customer web application:
- A top header with a dropdown menu which does not scroll when the page
is scrolled.
- A lower detail part of the screen (table) where the headers stay, and
|
by: abctech |
last post by:
Helo Friends,
I am a novice Java programmer, I'm working with Jsp + Javascript to develop a web application.I only have basic Html knowledge and I mostly use "FrontPage" to develop my web pages but currently my webpage requires some dHtml and CSS fundamentals hence I'm posting a query in this forum expecting some guidance,
I have a floating table in my webpage which I achieved using JS. I have written Jsp code to get database records one...
|
by: since |
last post by:
I figured I would post my solution to the following.
Resizable column tables.
Search and replace values in a table. (IE only)
Scrollable tables.
Sortable tables.
It is based on a lot examples I found on the web. Works in IE and mozilla.
http://www.imaputz.com/cssStuff/bigFourVersion.html
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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...
| |
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |