alert弹出框能不能改title标题(IE浏览器)

来源:百度知道 编辑:UC知道 时间:2024/06/24 19:05:22

alert弹出框不能修改title标题。
alert(“”);//弹出式输出功能,只是弹出一个东西,不能修改主页面的其他东西。
所以alert仅能作为一个辅助弹框功能使用,不能对其他东西进行修改。
若要修改,则需要动html/jsp里面的代码,或者使用js、jQuery来实现。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<script>
function changetitle(){
var theResponse = window.prompt("输入新标题","新标题");
document.title = theResponse;
}
</script>
<input type="button" value="更改网页标题" onclick="changetitle()" />
</body>
</html>

alert只能弹出消息,不能输入数据。