Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DHTML table content stylesheet not refreshed

    I'm having a little trouble with internet explorer. When adding table rows to tables via javascript, stylesheet class attributes do not render at all.

    I've looked into the table.refresh() command for IE, but it does not apply the style.

    I know it's not a stylesheet issue because if I place the same table declaration on the page statically right below the table that is dynamically added, the static table renders it's CSS properly while the dynamic table (which has an identical structure and content) does not render properly.

    Ideas?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having a look?

    Care to supply a link to said page?
    It sounds like the styles aren't re-rendered when you dynamically add table-related elements. Just for good measure, try if it works for regular elements like paragraphs; if not, I'm afraid you'll have to come up with another solution.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #3
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'll work on getting the styles for <p> tags and see if that helps. It's not so much the styles, but only when I apply the style via class="" for the DHTML elements.

  • #4
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK figured this one out.

    I was using a method to import an xml string into a dom object. I've included hte original method here:


    Code:
    	
    importNode: function(domDocument, node) {
    	switch (node.nodeType) {
    		case 1:
    			var element = domDocument.createElement(node.nodeName);
    			for (var i = 0; i < node.attributes.length; i++) {
    				element.setAttribute(node.attributes[i].nodeName, node.attributes[i].nodeValue);
    			}
    			for (var i = 0; i < node.childNodes.length; i++)
    				element.appendChild(oplib.importNode(domDocument, node.childNodes[i]));
    			return element;
    			break;
    		case 3:
    			var textNode = domDocument.createTextNode(node.nodeValue);
    			return textNode;
    			break;
    		/* add other nodes here */
    	}
    }
    I've found that you can't add set the class attribute via Javascript with setAttribute in Internet Explorer. The following code resolved my issue.

    Code:
    	importNode: function(domDocument, node) {
    		switch (node.nodeType) {
    			case 1:
    				var element = domDocument.createElement(node.nodeName);
    				for (var i = 0; i < node.attributes.length; i++) {
    					if (node.attributes[i].nodeName == 'class') {
    						element.className = node.attributes[i].nodeValue;
    					}
    					else {
    						element.setAttribute(node.attributes[i].nodeName, node.attributes[i].nodeValue);
    					}
    				}
    				for (var i = 0; i < node.childNodes.length; i++)
    					element.appendChild(oplib.importNode(domDocument, node.childNodes[i]));
    				return element;
    				break;
    			case 3:
    				var textNode = domDocument.createTextNode(node.nodeValue);
    				return textNode;
    				break;
    			/* add other nodes here */
    		}
    	}


  •  

    Posting Permissions

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