检测或设置是否为默认首页

<html xmlns:rdl>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>WEB开发笔记——JS获取判断浏览器的默认首页</title>
<style>
@media all {
rdl/:homepage {behavior:url(#default#homepage);}
}
</style>
<script>
var oHomePage,oCodeDiv,oURL;
var sHomePage;
function rdl_Verify(){
var sHomePage=oURL.value;
var bIs=oHomePage.isHomePage(sHomePage);
with (oCodeDiv) if (bIs) innerText=sHomePage+"是您的默认主页"; else innerText=sHomePage+"不是您的默认主页";
}
function rdl_Set(){
var sHomePage=oURL.value;
oHomePage.setHomePage(sHomePage);
}
function window.onload(){
oHomePage=document.all("idHomePage");
oCodeDiv=document.all("idCodeDiv");
oURL=document.all("idURL");
}
</script>
</head>
<body>
<rdl:homepage id="idHomePage" />
<table><tr>
<td><input type=text size=30 value="http://www.#.com/" id=idURL></td>
<td><input type=button value=" 检测 " onclick="rdl_Verify();"></td><td><input type=button value=" 设置 " onclick="rdl_Set();"></td>
</tr></table>
<br>
<br>
<div id=idCodeDiv>请确认输入框内的url地址然后点击「检测」按钮。</div>
<br>&nbsp;<br>&nbsp;<br>
</body>
</html>

你可能感兴趣的:(检测或设置是否为默认首页)