[Javascript] dom/javascript question regarding Internet Explorer

Mike Dougherty mdougherty at pbp.com
Fri Jul 20 08:59:58 CDT 2007


On 7/20/07, Lee Bettridge <lbettridge at twowaytv.co.uk> wrote:
> var str_title = title.firstChild.data;  (error = Object Required)

are you sure title.firstChild is an object?  Are you sure that object
has a .data property?  Have you tried the .text property?  (which
might work for IE but not Fx)

maybe something like this?

if( title.firstChild ) {
  if( title.firstChild.data ){
    var str_title = title.firstChild.data;
  }
  else if(title.firstChild.text) {
    var str_title = title.firstChild.text;
    }
  else {
    var str_title = "Unknown Title";
  }
}



More information about the Javascript mailing list