SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I ahve it all working in NS4+ and IE4+ but NN6 is giving me some grief. This is waht I have so far to write into a layer, what do I need to do to make it work with NN6. Please!
    Code:
    	function show_desc() {
    		if (isLoaded) {
    			if (n) {
    				descD.open();
    				descD.write('<span class="black">' + desc[curstep] + '</span>');
    				descD.close();
    				}			
    			if (domc) {
    				descD.innerHTML = '<span class="black">' + desc[curstep] + '</span>';
    				}
    			}
    		else {
    			return false;
    			}
    		return;
    		}
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  2. #2
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    This is coverd in my tutorial that I'm writing on DOM and dHTML. Anyway, althoguh innerHTML shoudl work iN NN 6 (I'm not sure how you detect that stuff (IE what browsers respond in your code to if(domc)). Anyway, here's one way to do it (using W3C way rather than innerHTML):

    Code:
         function writeLayer(layerID,txt){
                   if(document.body.getAttributeNode){
                             node = document.getElementById(layerID);
                             var newRange = document.createRange();
                             newRange.selectNodeContents(node);
                             newRange.deleteContents();
                             var newHTML = newRange.createContextualFragment(txtHTML);
                             node.appendChild(newHTML);
                   }else if(document.getElementById){
                             document.getElementById(layerID).innerHTML=txt;
                   }else if(document.all){
                             document.all[layerID].innerHTML=txt; 
                   }else if(document.layers){
                            with(document.layers[layerID].document){
                                       open();
                                       write(txt);
                                       close();
                             }
                   }
         }
    aDog

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ariella, I got it working thanks for responding. Not sure how but I went back and fixed my browser detection chunk and it works now, thanks again
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •