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 6142
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......
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
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_handler.previous.row.cells.0 is null or not a object
Pleaes suggest what i do?
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...
|
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 |...
|
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?...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |