1、
收藏本站
1
<
span style
=
"
CURSOR: hand
"
onClick
=
"
window.external.addFavorite('http://www.cosy.80.hk','温馨园')
"
title
=
"
温馨园
"
>
收藏本站
</
span
>
2、设为首页 <span οnclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.pfan.80.hk');" style="CURSOR: hand">设为首页</span> 3、去掉超链接的下划线 <style TYPE="text/css"> <!-- A:link{text-decoration:none} A:visited{text-decoration:none} A:hover {color: #ff00ff;text-decoration:underline} --> </style> 4、点击即可刷新本页 <a href="location.reload()" target="_self">刷新</a> 5、用户离开时启动收藏夹 第一步:把如下代码加入<head>到</head>区域中 <script language="javascript"> function bookmark(){ window.external.AddFavorite('http://joybbs.bokee.com', '程序爱好者') } </script> 第二步:把<body>中内容改为: <body bgcolor="#fef4d9" οnunlοad="bookmark()"> 6、JS发送邮件 以下代码加入<head>区域: <SCRIPT LANGUAGE="JavaScript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://www.skycx.com --> <!-- Begin function mailsome1(){ who=prompt("输入Email地址: ","lydi@skycx.com"); what=prompt("输入邮件主题: ","none"); if (confirm("你是真的要发送邮件给 "+who+" 主题是 "+what+"?")==true){ parent.location.href='mailto:'+who+'?subject='+what+''; } } // End --> </SCRIPT> 以下代码加入<body>区域: <a href='javascript:mailsome1()'>发送Email给某人!</a> <FORM> <input type=button value="发送Email给某人!" onClick="mailsome1()"> </FORM> 2. <A HREF="mailto:xxx@xxx.com">xxxxx</a> 7.JS时间 <script language="javascript"> setInterval("jnkc.innerHTML=new Date().toLocaleString()+''.charAt(new Date().getDay());",1000); </script> <span id=jnkc></span> 8.js复制代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Js复制代码</title> </head> <body> <p> <input type="button" name="anniu1" onClick='copyToClipBoard()' value="复制专题地址和url地址,传给QQ/MSN上的好友"> <script language="javascript"> function copyToClipBoard(){ var clipBoardContent=""; clipBoardContent+=document.title; clipBoardContent+=""; clipBoardContent+=this.location.href; window.clipboardData.setData("Text",clipBoardContent); alert("复制成功,请粘贴到你的QQ/MSN上推荐给你的好友"); } </script> <br /> <br /> 直接复制url <input type="button" name="anniu2" onClick='copyUrl()' value="复制URL地址"> <script language="javascript"> function copyUrl() { var clipBoardContent=this.location.href; window.clipboardData.setData("Text",clipBoardContent); alert("复制成功!"); } </script> <br/> <br/> 点击文本框时,复制文本框里面的内容 <input οnclick="oCopy(this)" value="你好.要copy的内容!"> <script language="javascript"> function oCopy(obj){ obj.select(); js=obj.createTextRange(); js.execCommand("Copy") alert("复制成功!"); } </script> <br /> <br /> 复制文本框或者隐藏域中的内容 <script language="javascript"> function CopyUrl(target){ target.value=myimg.value; target.select(); js=myimg.createTextRange(); js.execCommand("Copy"); alert("复制成功!"); } function AddImg(target){ target.value="[IMG]"+myimg.value+"[/ img]"; target.select(); js=target.createTextRange(); js.execCommand("Copy"); alert("复制成功!"); } </script> <input name=myimg type=hidden id=myimg value="http://pmp.cnblogs.com" /> <input name=imgurl type=text size=32 value="http://pmp.cnblogs.com" /> <input type=button value="点击这里复制本站地址" οnclick="CopyUrl(imgurl);" /> <br /> <br/> 复制span标记中的内容 <script type="text/javascript"> </script> <br /> <br /> <script type="text/javascript">function copyText(obj) { var rng = document.body.createTextRange(); rng.moveToElementText(obj); rng.scrollIntoView(); rng.select(); rng.execCommand("Copy"); rng.collapse(false); alert("复制成功!"); } </script> 以下是代码片段:<br /> <br /> <span id="tbid">http://pmp.cnblogs.com</span> [<a href="#" οnclick="copyText(document.all.tbid)">点击复制</a>]<br/><br/> <span id="tbid2">http://www.cnblogs.com/pmp</span> [<a href="#" οnclick="copyText(document.all.tbid2)">点击复制</a>]<br/><br/> </p> </body> </html> 网页在线发送电子邮件JS代码 以下代码加入<head>区域: <SCRIPT LANGUAGE="JavaScript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://www.skycx.com --> <!-- Begin function mailsome1(){ who=prompt("输入Email地址: ","lydi@skycx.com"); what=prompt("输入邮件主题: ","none"); if (confirm("你是真的要发送邮件给 "+who+" 主题是 "+what+"?")==true){ parent.location.href='mailto:'+who+'?subject='+what+''; } } // End --> </SCRIPT> 以下代码加入<body>区域: <a href='javascript:mailsome1()'>发送Email给某人!</a> <FORM> <input type=button value="发送Email给某人!" onClick="mailsome1()"> </FORM> |
所有评论(0)