473,395 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

refer URL

Hello,

I want to make a "send to friend" page,
I found a free to use script but it sends the URL that the visitor is on.
The script opens the default mailprogram and send the mail

Can I change the script , so I can send another URL instead of the URL the
visitor is on?
(I tried everything but nothing works, I'm not good at writing scripts as
well)

here is the script, please advice me what I have to change

thanks
u = window.location;
m = "I thought this might interest you...";
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.address);
if (good) {
// the following expression must be all on one line...
window.location =
"mailto:"+document.eMailer.address.value+"?subject ="+m+"&body="+document.tit
le+" "+u;
Jul 23 '05 #1
3 4507
moon wrote:
<snip>
Can I change the script , so I can send another URL instead of the URL the
visitor is on?

u = window.location;
m = "I thought this might interest you...";
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.address);
if (good) {
// the following expression must be all on one line...
window.location =
"mailto:"+document.eMailer.address.value+"?subject ="+m+"&body="+document.tit
le+" "+u;


Maybe something like this. I'm assuming good is set to true in the
checkEmailAddress function if it says the address is valid.

u = 'http://www.google.com'; // put the url you want to send here
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+"&amp;body="+document.title+"
"+u;
}

Mike

Jul 23 '05 #2

thanks mike, it works!! :)
I had tried to put "http://www.google.com"; instead 'http://www.google.com'
and it did not work, but yours do.
Do you have an idea how I can add some more in the message, right now it say
the title and the URL in the message.
It's not so important but would be nice if I could add some more in message

thanks again
Gert

Maybe something like this. I'm assuming good is set to true in the
checkEmailAddress function if it says the address is valid.

u = 'http://www.google.com'; // put the url you want to send here
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+"&amp;body="+document
..title+" "+u;
}

Mike

Jul 23 '05 #3
moon wrote:

I missed a few things in my first reply, I'll try to correct them in
this message:

First of all, using 'mailto:' is not recommended:

http://www.allmyfaqs.com/faq.pl?Email_form_data
http://www.isolani.co.uk/articles/mailto.html
If you still want to use mailto...
u = window.location;
m = "I thought this might interest you...";
These variables should be local - if they are only used in the function
mailThisUrl - they should be declared using var in the function. Use
local variables whenever possible. Here's a little reading about
declaring variables, and global/local variable scope.

http://www.mredkj.com/tutorials/refe..._intro_ex.html
http://www.eecs.tufts.edu/~stauber/m...js_basics.php3

"mailto:"+document.eMailer.address.value+"?subject ="+m+"&body="+document.tit le+" "+u;


I broke the string into pieces and placed it in a local variable so it
is easier to see what's going on. Change the last line to include the
additional message body text you want instead of "test string'.

var msgstring = 'mailto:' + document.eMailer.address.value;
msgstring += '?subject=' + subject;
msgstring += '&body=' + document.title + ' ' + sendurl + ' ';
msgstring += 'test string' //place message text within single quotes
Give this version a try and see if it does what you want, if you don't
use CGI or the free alternatives listed above:

function mailThisUrl() {
var sendurl = 'http://www.google.com';
var subject = "I thought this might interest you...";
var good = false;
checkEmailAddress(document.eMailer.address.value);
if (good) {
var msgstring = 'mailto:' + document.eMailer.address.value;
msgstring += '?subject=' + subject;
msgstring += '&body=' + document.title + ' ' + sendurl + ' ';
msgstring += 'test string' //place message text within single quotes
window.location = msgstring;
}
}

Please don't top post, it messes up the Q&A flow.
MIke

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
I've been trying to setup Dean Allen's excellent "Refer" script. (http://www.textism.com/tools/refer/) The instructions say to add this code to the bottom of whatever web pages you want the...
1
by: 5tein | last post by:
I mean, with XSL functions such as SELECT can I only refer to XML element values or can I somehow also refer to XML attribute values? Is there any way to refer to XML content based on attribute...
0
by: jacksuyu | last post by:
I have two xsd files, in one xsd file, I defined a "key", I'd like to use "keyref" to refer to that "key" from another xsd file. But I always get attribute is empty error. my.xsd is my first xsd...
3
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One...
16
by: ben beroukhim | last post by:
I have huge number of legacy code which use standard files functions. I would like to pass a memory pointer rather than a FILE pointer. I am trying to use FILEs in the code to refer to memory...
0
by: MattB | last post by:
The relates to my question earlier about how to format labels in a CBL (CheckBoxList) to not wrap. I think I've found an approach that will probably work when I can figure out how to refer to a...
4
by: Ryan | last post by:
I have some custom forms that contain their own properties and I call them as such: Dim myDialog As New myDialogForm myDialog.mID = 1 ' sets the custom property mID to 1...
1
by: Sebastian Bassi | last post by:
I am writing a paper where I refer to Python. Is there a paper that I can refer the reader to? Or just use the Python web page as a reference?
6
by: Savante | last post by:
I have been writing a datalogging application. It reads in double's into a database. I want to be able to click on a row in a database (holds name of variable and also current value of variable)...
9
by: R. Rajesh Jeba Anbiah | last post by:
I'm just wondering, what is the correct way to refer to "!important". I currently refer it is "not important"--but I guess, it's wrong. What is the correct way? TIA -- <?php echo 'Just another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.