更改文档标题不起作用

时间:2012-10-13 14:50:56

标签: javascript jquery title

我正在尝试将通知编号添加到函数中的标题中,但它不起作用。这是我的代码:

  var docTitle = document.title;

  document.title = "".docTitle." (".$(".loadnot").html().")";

3 个答案:

答案 0 :(得分:8)

在JavaScript中,您应该使用+来连接.

document.title = docTitle + "(" + $(".loadnot").html() + ")";

答案 1 :(得分:3)

甚至更好:

document.title += " ("+$(".loadnot").html()+")";

答案 2 :(得分:0)

检查此:

window.top.document.title = "Your Title";