如何更改页面标题

发布于 2024-12-05 03:16:55 字数 286 浏览 1 评论 0原文

可能的重复:
jQuery:如何在 .ready() 期间更改文档标题?

如何用jquery和ajax更改页面名称?

我想使用 php 脚本并调用加载函数。该函数将标题返回给我。如何设置页面标题?

Possible Duplicate:
jQuery: how to change title of document during .ready()?

How to change the name of the page with jquery and ajax?

I would like to use php script and call the load function. The function returns the title to me. How do I set the page title?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

妖妓 2024-12-12 03:16:56

当您只需执行

document.title = 'foo';

时,JQuery 对于设置标题可能有点过大,但如果您确实想使用 JQuery,则可以执行

$("title").text ("foo");

虽然它可能会慢很多,但如果你只做一次我就不会担心。

JQuery is probably overkill for setting a title when you can just do

document.title = 'foo';

but if you really want to use JQuery you can do

$("title").text("foo");

It's probably a lot slower though, although if you're only doing it once I wouldn't worry about that.

短暂陪伴 2024-12-12 03:16:56
$("title").first().text("New title");
$("title").first().text("New title");
花开浅夏 2024-12-12 03:16:56
document.title("Whatever Title");

我也想知道这是否有效:

$("title").html("Whatever Title");
document.title("Whatever Title");

also i wonder if this will work:

$("title").html("Whatever Title");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文