jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes How to eliminate the diffrence between firefox and ie about this problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to eliminate the diffrence between firefox and ie about this problem" Watch "How to eliminate the diffrence between firefox and ie about this problem" New topic
Author

How to eliminate the diffrence between firefox and ie about this problem

lei liu
Greenhorn

Joined: Nov 16, 2005
Posts: 4
How to eliminate the diffrence between firefox and ie about this problem

the code below:

var template = '<div class="fileheadbg">'
+'<div class="filename"><a href="/" >__name__</a></div>'
+'<div class="fileimg"><img src="images/property.gif" width="9" height="10" hspace="0" align="middle"></div>'
+'<div class="fileimg"><img src="images/download.gif" width="9" height="10" align="middle"></div>'
+'</div>';


the above variable is store the text:

<div class="fileheadbg">
<div class="filename" id="filename__id__"><a href="/" >__name__</a></div>
<div class="fileimg" id="property__id__"><img src="images/property.gif" width="9" height="10" hspace="0" align="middle"></div>
<div class="fileimg" id="download__id__"><img src="images/download.gif" width="9" height="10" align="middle"></div>
</div>


when i do this:

var elem = document.createElement('div');
elem.innerHTML = template;
alert(elem.childNodes.length);
//outputs
//in IE: 1
//in FireFox: 3

why like this???

now my target is after set the elem.innerHTML, I 'll get the reference of the div with id='property__id__' instantly
how can i complete the mission???
I think I can hard code the :
var proElem = elem.childNodes[0].childNodes[2]; //IE only
but FireFox not work,how to ensure the compatible??

Please Help me ,and I'm not good at english, thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

"digital ghost",

There aren't may rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
lei liu
Greenhorn

Joined: Nov 16, 2005
Posts: 4
ok ,I have modify the nick name to my real name ,sorry!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I think you need to append the div to the page, then you can look at its children.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to eliminate the diffrence between firefox and ie about this problem
 
Similar Threads
tiles and <sx:autocompleter>
iframe in struts? help me out...
How to getParameter value
tomcat crashes when counting lines in a text file
Using DIVs instead of Table