<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="second1.css">
<script type="text/javascript" src="setHomeSetFav.js" charset="utf-8"></script>
<title>槿漫轩</title>
</head>
<body>
<body>
<div class="top_bg">
<div class="top_content">
<ul>
<li><a href="#">联系我们</a></li>
<li><a onclick="AddFavorite(window.location,document.title)" href="javascript:void(0)">加入收藏</a></li>
<li><a onclick="SetHome(window.location)" href="javascript:void(0)">设为首页</a></li>
</ul>
</div>
</div>
</body>
</html>
//加入收藏 function AddFavorite(sURL, sTitle) { sURL = encodeURI(sURL); try { window.external.addFavorite(sURL, sTitle); } catch (e) { try { window.sidebar.addPanel(sTitle, sURL, ""); } catch (e) { alert("加入收藏失败,请使用Ctrl+D进行添加,或手动在浏览器里进行设置."); } } } //设为首页 function SetHome(url) { if (document.all) { document.body.style.behavior = 'url(#default#homepage)'; document.body.setHomePage(url); } else { alert("您好,您的浏览器不支持自动设置页面为首页功能,请您手动在浏览器里设置该页面为首页!"); } }
看一下你的js文件的编码 和你html的编码 还有你浏览器的编码
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 不觉得少了个双引号 吗