SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: eval problem
-
Nov 17, 2006, 12:59 #1
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
eval problem
hi
i have this issue which wont work...
theCode:alert(typeof objt); // alerts "object" if(objTable) setTimeout("eval('do_transfer("+objt+")')", 2000);
Code:Error: missing ] after element list Source File: http://localhost/eden/js/adm_ajax.js Line: 148, Column: 20 Source Code: do_transfer([object HTMLTableElement])
thanx in advance
-
Nov 17, 2006, 14:45 #2
- Join Date
- Apr 2004
- Location
- germany
- Posts
- 4,324
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
When you concatenate an object, the object is converted to a string.
-
Nov 17, 2006, 15:24 #3
- Join Date
- Jan 2005
- Location
- Too far up north
- Posts
- 1,566
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
There is no need to use eval. Do this instead:
Code:window.setTimeout(function(){ do_transfer(objt); }, 2000);
-
Nov 18, 2006, 03:05 #4
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanx pepe
that solved the problem now i have the same error here
Code:table_.tBodies[0].rows[i].setAttribute("onclick", "addArtikal("+objTable+", "+table_.tBodies[0].rows[i]+")");
thanx in advance
-
Nov 18, 2006, 03:38 #5
- Join Date
- Jan 2005
- Location
- Too far up north
- Posts
- 1,566
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Setting onclic witht he setAttribute method won't work in IE.
Try something like this instead:
Code:table_.tBodies[0].rows[i].onclick = function() { // using the keyword "this" will refrence to this html node }
-
Nov 18, 2006, 03:59 #6
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thank you very much!
i solved the problem
Bookmarks