SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: eval problem

  1. #1
    SitePoint Wizard
    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...
    the
    Code:
    alert(typeof objt); // alerts "object"
    if(objTable) setTimeout("eval('do_transfer("+objt+")')", 2000);
    and i get the following error
    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])
    any suggestion appreciated
    thanx in advance

  2. #2
    SitePoint Wizard stereofrog's Avatar
    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.

  3. #3
    SitePoint Wizard Pepejeria's Avatar
    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);

  4. #4
    SitePoint Wizard
    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]+")");
    any suggestion appreciated..
    thanx in advance

  5. #5
    SitePoint Wizard Pepejeria's Avatar
    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
    }

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you very much!
    i solved the problem


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •