通过浮动窗口把当前页面地址通过邮件发送出去

2009-02-14 11:55:22 | 【

在页面上漂浮一个浮动窗口,用户可以在文本框内输入好友Email地址,点击发送会自动生成一封邮件,打开邮件客户端软件把当前网页地址作为邮件正文发送出去

查看演示页面 View Demo 查看全部代码 View Code

在网页<head>区添加以下代码


<script>

        /*****************************************************
         *  Share JavaScript (http://www.ShareJS.com)
         * 使用此脚本程序,请保留此声明
         * 获取此脚本以及更多的JavaScript程序,请访问 http://www.ShareJS.com
         ******************************************************/
    
var hX = 340;
var vY = -140;
</script>



在网页<body>区添加以下代码

<div id="FloatMail" style="position: absolute;
                           background-color: #000000;
                           background-image:url('float_dots.gif');
                           width: 180px;
                           border-width: 2;
                           border-style:outset;
                           border-color:#444444;
                           padding:5px">
<center>
<form name="eMailer">
<font size="2" face="Verdana,Arial" color="#ff0056">
E-Mail This Link
<br>
Enter recipient's e-mail:
</font>
<br>
<input type="text" name="address" size="20"
style="background-color:#000000;
       color:#05fa9e;
       border-color:#ff0000;
       border-width:1;
       border-style:dashed;
       margin-top:7px;"><br>
<input type="button" value="Send this URL" onClick="mailThisUrl();"
style="color:#ff0057;
       font-family:Arial;
       font-size:10pt;       
       background-color:#000000;
       border-width:1;
       border-style:solid;
       border-color:#242424;
       margin-top:7px;">
</form>
</center>
</div>


<!-- End of editable HTML //-->

<script>
/* Floating Mail-This-Link Script C.2004 by CodeLifter.com */
/* Caution! Do not allow linebreaks other than where shown */
var good;function checkEmailAddress(field){
var goodEmail=field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail){good = true}else{alert('Please enter a valid e-mail address.');
field.focus();field.select();good=false;}}
u=window.location;m="I thought this might interest you...";
function mailThisUrl(){good=false;
checkEmailAddress(document.eMailer.address);
if (good){window.location="mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;}}
var nn=(navigator.appName.indexOf("Netscape")!=-1);
var dD=document,dH=dD.html,dB=dD.body,px=dD.layers?'':'px';
function floatMail(iX,iY,id){
var L=dD.getElementById?dD.getElementById(id):dD.all?dD.all[id]:dD.layers[id];		
this[id+'O']=L;if(dD.layers)L.style=L;L.nX=L.iX=iX;L.nY=L.iY=iY;
L.P=function(x,y){this.style.left=x+px;this.style.top=y+px;};L.Fm=function(){var pX, pY;	
pX=(this.iX >=0)?0:nn?innerWidth:nn&&dH.clientWidth?dH.clientWidth:dB.clientWidth;	
pY=nn?pageYOffset:nn&&dH.scrollTop?dH.scrollTop:dB.scrollTop;	
if(this.iY<0)pY+=nn?innerHeight:nn&&dH.clientHeight?dH.clientHeight:dB.clientHeight;	
this.nX+=.1*(pX+this.iX-this.nX);this.nY+=.1*(pY+this.iY-this.nY);this.P(this.nX,this.nY);
setTimeout(this.id+'O.Fm()',33);};
return L;}
floatMail(hX,vY,'FloatMail').Fm();
</script>

<!-- End FloatMail Code //-->


可以根据需要修改邮件正文和标题内容

下载"通过浮动窗口把当前页面地址通过邮件发送出去"

  • 本地下载
  • 本地下载2

相关资源