473,387 Members | 1,897 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,387 software developers and data experts.

tr.cells is undefined

Hello,
I've got a table, with a cell you can click in every line.
When clicked, a popup containing a form shows up.
When submitting the form, I'd like to change the background color of the cell I've just clicked. However, the code below doesn't work, and I'd like to know what's wrong (the popup is included once in the ftl file):

Thanks !

/************* html *************/
Expand|Select|Wrap|Line Numbers
  1. <td onclick="openCall(${i.id}, '${i.askable.label}', '${telephone}', this.parentNode)">
  2. ...
  3. </td>
  4.  
/************ pop-up ************/
Expand|Select|Wrap|Line Numbers
  1. <div style="clear:both"></div>
  2. <div class="lightBox" style="display:none" id="popupCallBackground"></div>
  3.  
  4. <div class="popupLightBox" style="display:none" id="popupCall">
  5.     <div class="popupLightBoxTop">
  6.         <div class="popupLightBoxTitle">
  7.             Téléphone de l'entreprise <span id="askableLabel"></span>
  8.         </div>
  9.     </div>
  10.     <div class="popupLightBoxContent">
  11.  
  12.         Téléphone : <span id="telephoneCall"></span><br/>
  13.         <form id="callForm" action="">
  14.         <input type="submit" value="oui"/>&nbsp;&nbsp;&nbsp;<input type="button" value="non" onclick="closeCall()"/>
  15.         </form>
  16.     </div>
  17.     <div class="popupLightBoxBottom">
  18.     </div>
  19.  
  20. </div>
  21.  
/********** javascript **********/
Expand|Select|Wrap|Line Numbers
  1. function openCall(id, askableLabel, telephone, tr){
  2.     $('popupCallBackground').show();
  3.     $('popupCall').show();
  4.     new Draggable('popupCall', {zindex: 5});
  5.     $('askableLabel').update(askableLabel);
  6.     $('telephoneCall').update(telephone);
  7.     $('callForm').action="javascript:callPassed("+id+", '"+tr+"')";
  8. }
  9.  
  10. function closeCall(){
  11.     $('popupCallBackground').hide();
  12.     $('popupCall').hide();
  13. }
  14.  
  15. function callPassed(id, tr){
  16.     var fin=new Date().format();
  17.     tr.cells[4].innerHTML="passé le :<br/>"+fin;
  18.     tr.cells[4].style.background="teal";
  19.     AdminService.updatePhoneCall(id, function(data){
  20.  
  21.     });
  22. }
  23.  
Aug 19 '09 #1
2 3618
Markus
6,050 Expert 4TB
This line
Expand|Select|Wrap|Line Numbers
  1. $('callForm').action="javascript:callPassed("+id+" , '"+tr+"')";
is wrong. Doing "+id+" will pass the string '+id+', when I think you intended to concatenate the object into the argument. Simply remove the quotes and the plus signs, and the object will be passed properly (do the same for the tr, too).
Aug 19 '09 #2
When I do this

Expand|Select|Wrap|Line Numbers
  1.    1. $('callForm').action="javascript:callPassed("+id+" , tr)";
  2.  
it says :
tr is not defined
Aug 19 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: mrid via DotNetMonster.com | last post by:
hi. im exporting data from a vb form to excel. i am able to create a new excel file, save and edit it without any trouble, but the formatting is giving me hell! i need to be able to show certain...
1
by: mgoold2002 | last post by:
I'm moving some code from Excel vbs into a .NET context and I'm very new to .NET. I'm trying to make this Excel vb code work in .NET. My questions are: how do I reference cells correctly using...
1
by: samn | last post by:
I wrote the following script in order to traverse an HTML table and merge the cells that have the same value across multiple rows. For some reason, however, it works for the first, third, and...
3
by: Eric Layman | last post by:
Hi, I have a script here which will loop thru a table and check for it's background color. But it doesn't work on Firefox. The Error Inspector said "ERROR. obj.cells has no properties How...
1
by: jobs | last post by:
Can somebody tell me why Jobno and Value BoundFields are not available during the command SaveParm ? i enter text into the box for Value and hit the Save button, but all I see is the Parmvalue. ...
0
by: gggram2000 | last post by:
Hi there, I'm using microsoft visual studio 2005, with c# code. I recently downloaded GemBox which is a spreadsheet for excel. I can pass parameters through textboxes, comboboxes, labels...etc...
2
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the...
1
by: rytsyd | last post by:
Hi, I already have a working code where I have an application that queries to SQL then exports it to excel. It also merge cells that have the same value. The only problem I have is that it takes...
5
by: Test | last post by:
Is it possibel to have DIV's inside a table cell so that their position can be given relative to top left corner of the cell. Now the DIVs seem to position themselves relative to previous object.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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
Oralloy
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 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.