方法转换IE、Firefox、Chrome区别

mac2022-06-30  27

 1  <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >  2  < html  xmlns ="http://www.w3.org/1999/xhtml" >  3  < head >  4      < meta  http-equiv ="Content-Type"  content ="text/html;charset=UTF-8" />  5      < title ></ title >  6      < script  type ="text/javascript" >  7          var person1 = {  8             toLocaleString: function () {  9                  return "Nikolaos"; 10             }, 11             toString: function () { 12                  return "Nicholas"; 13             } 14         }; 15          var person2 = { 16             toLocaleString: function () { 17                  return "Grigorios"; 18             }, 19             toString: function () { 20                  return "Greg"; 21             } 22         }; 23          var people = [person1, person2]; 24         console.log(people); 25         console.log(people.toString()); 26         console.log(people.toLocaleString()); 27      </ script > 28  </ head > 29  < body > 30  </ body > 31  </ html >

IE下显示

Nicholas,Greg

Nicholas,Greg  

Nikolaos, Grigorios

firefox、chrome下显示

Nicholas(Object),Greg(Object)

Nicholas,Greg 

Nikolaos, Grigorios

 

 

 

转载于:https://www.cnblogs.com/qzsonline/archive/2012/01/17/2324821.html

相关资源:兼容IE、FireFox、Chrome等浏览器的xml处理函数js代码
最新回复(0)