Change the title of the document:
document.title = "Some new title text";
Click the button to change the title of the document.
<!DOCTYPE html> <html> <head> <title>My title</title> </head>/* w ww. j av a2 s . co m*/ <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.title = "Some new title text"; document.getElementById("demo").innerHTML = "The title of the document was changed."; } </script> </body> </html>