您的位置:首页 > 其它

方法转换IE、Firefox、Chrome区别

2012-01-17 16:28 274 查看
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";

},

toString:function () {

return "Nicholas";

}

};

var person2 = {

toLocaleString:function () {

return "Grigorios";

},

toString:function () {

return "Greg";

}

};

var people = [person1, person2];

console.log(people);

console.log(people.toString());

console.log(people.toLocaleString());

</script>

</head>

<body>

</body>

</html>

IE下显示

Nicholas,Greg

Nicholas,Greg

Nikolaos, Grigoriosfirefox、chrome下显示

Nicholas(Object),Greg(Object)

Nicholas,Greg

Nikolaos, Grigorios
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: