【JS】更改页面Title
关键:document.title属性
代码:
<!DOCTYPE html> <html lang="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <head> <title>Filename</title> </head> <body> <button onclick="modifyTitle('ABC.bmp')">Click</button> </body> </html> <script type="text/javascript"> <!-- //------------------------------- // 更改Title //------------------------------- function modifyTitle(filename){ var title=document.title;// 取值 title=title.replace("Filename",filename);// 替换 document.title=title;// 赋值 } //--> </script>
END