JS中的document.title可以獲取當前網頁的標題
1 2 3 4 5 6 7 8 9 10 11 12 <!DOCTYPE html> <html> <head> <title>jb51.net</title> </head> <body> current document's title is: <script> document.write(document.title); </script> </body> </html>運行結果如下:
1 current document's title is:jb51.net