SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Table rows collection help

    This works in Firefox, but not in IE.

    for (var i in appraisertable.rows) {
    var row = appraisertable.rows[i];
    alert(row.id);
    }

    IE displays "undefined" and gives the error "id is null or not an object." Like I said before, Firefox works great. What's my problem here?

  2. #2
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Tdixon,

    Can you show us some more of your code please. It suggests that in Internet Explorer row isn't being set to anything.
    Don't be shy, Click Reply
    www.freecontactus.com - Add a contact page to your
    web site in minutes. No coding required!!

  3. #3
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's all of the relevant parts of my JS file. Everything works until the updateHighlighting() function is called:

    Code:
    var selRows = new Array();
    var appraisertable = '';
    
    function renderTable() {
    	var appraisers = fetchObject();
    	var html = '<table id="appraisertable" cellpadding="0" cellspacing="0">';
    	for(var key in appraisers) {
    		html += '<tr id="' + appraisers[key].zipid + '" onclick="rowClick(this, event)"><td>' + appraisers[key].name + '</td>';
    		html += '<td>' + appraisers[key].city + ', ' + appraisers[key].state + ' ' + appraisers[key].zip + '</td>';
    		html += '<td>' + appraisers[key].phone + '</td></tr>';
    	}
    	html += '</table>';
    	document.getElementById("tablediv").innerHTML = html;
    	appraisertable = dojo.byId("appraisertable");
    	dojo.html.disableSelection(appraisertable);
    }
    
    function rowClick(row, e) {
    	if(e.shiftKey) {
    	} else if (e.metaKey || e.ctrlKey) {
    		if (selected(row.id)) {
    			unselect(row.id);
    		} else {
    			selRows.push(row.id);
    		}
    	} else {
    		selRows = new Array();
    		selRows[0] = row.id;
    	}
    	updateHighlighting();
    }
    
    function updateHighlighting() {
    	for (var i in appraisertable.rows) {
    		var row = appraisertable.rows[i];
    		if (selected(row.id)) {
    			row.className = "selected";
    		} else {
    			row.className = "unselected";
    		}
    	}
    }

  4. #4
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So nobody can see any problems? Is the rows[] collection in IE different from that in Firefox? I'd really appreciate some guidance.

  5. #5
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I guess you fixed this now but its because you are putting an item with the id of appraisertable into a variable of appraisertable. IE doesn't like it so if you change one of the variable names then it will work.
    Don't be shy, Click Reply
    www.freecontactus.com - Add a contact page to your
    web site in minutes. No coding required!!


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
  •