使用javascript修改title

  1.这个在chrome中可以成功,在ie8中报错

   

<!DOCTYPE html>
<html>
    <head>
        <title id="title">我是标题</title>
        <script type="text/javascript">
                var title = document.getElementById('title');
                title.innerText = "我是修改后的标题"; 
        </script>
    </head>    
    <body>
            
    </body>
</html>

 

  2.ie8中修改方法:

 

<!DOCTYPE html>
<html>
    <head>
        <title id="title">我是标题</title>
        <script type="text/javascript">
                document.title = "我是修改后的标题"; 
        </script>
    </head>    
    <body>
    </body>
</html>

 

  

posted on 2014-02-11 10:31  爱生活的夜  阅读(878)  评论(0编辑  收藏  举报