'send to a friend using msn' script

  • Thread starter Thread starter Peter Kelly
  • Start date Start date
P

Peter Kelly

I'm building a website and I want to add a script that allows a reader to
send to an msn buddy by clicking an icon. Is there such a script available?
 
Peter said:
I'm building a website and I want to add a script that allows a
reader to send to an msn buddy by clicking an icon. Is there such a
script available?

Do you want to send a message suggesting your website to the named friend?
The following will do this. Modify it if you want to do something slightly
different

Add to extenal.js
//-----------------
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one line...
if (field.value.match
(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
//-------------------------------
function mailThisUrl()
{
var subj = "I thought this might interest you..."
var text = "Here is an interesting Website: "

var content = new Array()
content[0] = "mailto:"
content[1] = document.eMailer.address.value
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content[6] = parent.document.title
content[7] = " ("
content[8] = parent.location
content[9] = ")"
content = content.join("")

if (checkEmailAddress(document.eMailer.address))
window.location = content
}
//-------------------------------

Add to <head>:
<script type="text/javascript" src="scripts/external.js"></script>

Add to <body>:
<form name="eMailer" action="">
<b>E-Mail this link to a friend</b><br />
Enter recipient's e-mail:<br />
<input type="text" name="address" size="30" /><br />
<input type="button" value="Send this URL" onclick="mailThisUrl()" />
</form>

It works in IE6. Should be O.K. for other browsers.
 
great, thanks..i'll give this a try

Trevor L. said:
Peter said:
I'm building a website and I want to add a script that allows a
reader to send to an msn buddy by clicking an icon. Is there such a
script available?

Do you want to send a message suggesting your website to the named friend?
The following will do this. Modify it if you want to do something slightly
different

Add to extenal.js
//-----------------
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one
line...
if (field.value.match

(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
//-------------------------------
function mailThisUrl()
{
var subj = "I thought this might interest you..."
var text = "Here is an interesting Website: "

var content = new Array()
content[0] = "mailto:"
content[1] = document.eMailer.address.value
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content[6] = parent.document.title
content[7] = " ("
content[8] = parent.location
content[9] = ")"
content = content.join("")

if (checkEmailAddress(document.eMailer.address))
window.location = content
}
//-------------------------------

Add to <head>:
<script type="text/javascript" src="scripts/external.js"></script>

Add to <body>:
<form name="eMailer" action="">
<b>E-Mail this link to a friend</b><br />
Enter recipient's e-mail:<br />
<input type="text" name="address" size="30" /><br />
<input type="button" value="Send this URL" onclick="mailThisUrl()" />
</form>

It works in IE6. Should be O.K. for other browsers.
 
actually, i have that...i was looking for a script that when clicked, would
open up a window of msn where you could send "X" article to an msn friend

Trevor L. said:
Peter said:
I'm building a website and I want to add a script that allows a
reader to send to an msn buddy by clicking an icon. Is there such a
script available?

Do you want to send a message suggesting your website to the named friend?
The following will do this. Modify it if you want to do something slightly
different

Add to extenal.js
//-----------------
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one
line...
if (field.value.match

(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
//-------------------------------
function mailThisUrl()
{
var subj = "I thought this might interest you..."
var text = "Here is an interesting Website: "

var content = new Array()
content[0] = "mailto:"
content[1] = document.eMailer.address.value
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content[6] = parent.document.title
content[7] = " ("
content[8] = parent.location
content[9] = ")"
content = content.join("")

if (checkEmailAddress(document.eMailer.address))
window.location = content
}
//-------------------------------

Add to <head>:
<script type="text/javascript" src="scripts/external.js"></script>

Add to <body>:
<form name="eMailer" action="">
<b>E-Mail this link to a friend</b><br />
Enter recipient's e-mail:<br />
<input type="text" name="address" size="30" /><br />
<input type="button" value="Send this URL" onclick="mailThisUrl()" />
</form>

It works in IE6. Should be O.K. for other browsers.
 
Peter said:
actually, i have that...i was looking for a script that when clicked,
would open up a window of msn where you could send "X" article to an
msn friend

Sorry, I'll have to leave it to someone else to make suggetsions
 
For an example of what I mean, look up www.msnbc.com and look up any
article...there's an icon that lets you do just that...connected to a
javascript of course...
elusive!!
 
Peter said:
For an example of what I mean, look up www.msnbc.com and look up any
article...there's an icon that lets you do just that...connected to a
javascript of course...
elusive!!

Peter,
This is the function used on this page
function emThis()
{
trackit();
var et = 'mailto:?subject='
+ (pd_me.nw?'Newsweek.com%20on%20MSNBC':'MSNBC.com')
+ '%20Article:%20'
+ pd_esc(pd_me.h)
+ '&body='
+ pd_esc(pd_me.h)
+ '%0D%0A'
+ pd_esc(pd_me.d)
+ '%0D%0Ahttp://g.msn.com/0MN2ET7/2%3Fhttp://'
+ location.host
+ '/id/'
+ pd_me.id
+ pd_me.su
+ '/from/ET/'
+ '%26%26CM%3DEmailThis%26CE%3D1%0D%0A%0D%0A';

if(pd_me.ep!='')
et += '%0D%0A_____________________________%0D%0A'
+ pd_me.ep;
location.href=et;
}

It is basically a mailto: command.
I can see these variables and functions:
trackit()
pd_me.nw
pd_esc()
pd_me.h
pd_me.d
pd_me.id
pd_me.su
pd_me.ep
What they all are are is anyone's guess

I think it would take a lot of deciphering to figure out what is happenning
 
Back
Top