473,714 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Send to A Friend And Java Problem

I can't figure out why this script won't insert the subject in the email and
why can't I control the font and size being used? I'm not sure where to post
this. Let me know where if this is OT.
<SCRIPT LANGUAGE="JavaS cript">
<!-- Begin
function isPPC() {
if (navigator.appV ersion.indexOf( "PPC") != -1) return true;
else return false;
}
if(isPPC()) {
document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?subject\=Take a
look at website I found.?body=You can see this website at
http://www.BrokerAgent Training.com\" onMouseOver="wi ndow.status=\'S end your
friends e-mail about this website\'; return true" TITLE="Send your friends
e-mail about this website">this website<\/A> to a friend</b>');
}
else { document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?body\=Take
a look at this website I found. You can see this website at
http://www.BrokerAgent Training.com\" onMouseOver="wi ndow.status=\'S end your
friends e-mail about this website\'; return true" TITLE="Send your friends
e-mail about this website">this website<\/A> to a friend</b>');
}
// End -->
</script>
--
Warmest regards,

Steve Horrillo, Realtor / CEO / C.Ht.
http://brokeragenttraining.com (Advanced training for real estate
professionals)
http://over100percent.com (Realtors earn over 100 percent
http::/hipfsbo.com (a helpful place for the serious home seller or buyer who
is open to new ideas)
Jul 23 '05 #1
15 3309
1. "<!----- Begin" is an invalid javascript function. It should have
the slashes in front of it (like the end).

2.The slashes in the mailto addy are not supposed to be there.

3.Towards the end you put "<\/a>" instead of </a>

4.You should probably check out
http://msdn.microsoft.com/library/de...ned/mailto.asp
as I found it very helpful.

l8r

Jul 23 '05 #2
Steve Horrillo wrote:
I can't figure out why this script won't insert the subject in the email and
why can't I control the font and size being used? I'm not sure where to post
this. Let me know where if this is OT.
<SCRIPT LANGUAGE="JavaS cript">
<!-- Begin
function isPPC() {
if (navigator.appV ersion.indexOf( "PPC") != -1) return true;
else return false;
}
if(isPPC()) {
document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?subject\=Take a
look at website I found.?body=You can see this website at
http://www.BrokerAgent Training.com\" onMouseOver="wi ndow.status=\'S end your
friends e-mail about this website\'; return true" TITLE="Send your friends
e-mail about this website">this website<\/A> to a friend</b>');
}
else { document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?body\=Take
a look at this website I found. You can see this website at
http://www.BrokerAgent Training.com\" onMouseOver="wi ndow.status=\'S end your
friends e-mail about this website\'; return true" TITLE="Send your friends
e-mail about this website">this website<\/A> to a friend</b>');
}
// End -->
</script>


Your JavaScript has a problem with quotes my friend. My advice when
writing complicated strings with quotes is to build up the string in
bits in a buffer variable. Much much easier to debug.

var buf='<b>Send <A CLASS="contact" HREF="mailto:?s ubject=Take a';
buf+='look at website I found.&body=You can see this website at';
buf+=' http://www.BrokerAgent Training.com" onMouseOver="wi ndow.status=';
buf+="'Send your friends e-mail about this website'; return true";
buf+='" TITLE="Send your friends e-mail about this website">this
website</a> to a friend</b>';
document.write( buf);

Also, mailto link are not reliable, and not all clients will fill in the
body...

And the separator from the subject should be a '&' not '?'
"mailto:em***@b ogus.com?subjec t=Some subject&body=Yo ur body text"

Lastly this is a JavaScript, not Java problem.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jul 23 '05 #3
Steve Horrillo wrote:
I can't figure out why this script won't insert the subject in the email and
why can't I control the font and size being used? I'm not sure where to post
Which font and size? In the e-mail or on the page? One 'mailto' is
using body, the other subject. Was that intended? Otherwise, they
seem to do exactly the same thing.

If you mean in the e-mail, you only have whatever is supported by the
e-mail client, and you have no idea what that is, what is supports or
even if there is one configured. So you are taking pot luck that this
will work at all.

I have no idea why you are even testing for 'PPC' in the navigator
appName string, but here goes...
this. Let me know where if this is OT.
<SCRIPT LANGUAGE="JavaS cript">
The language attribute is depreciated, type is required:

<script type="text/javascript">
<!-- Begin
Hiding script element content is unnecessary and potentially harmful -
don't do it.
function isPPC() {
if (navigator.appV ersion.indexOf( "PPC") != -1) return true;
It is very unreliable to depending on the browser to telling you
honestly what the platform is. Accept that it will be wrong a good
percentage of the time (but that is likely not really an issue in this
case).

What is the point of detecting 'PPC'?
else return false;
}
A simpler (though no more accurate) function is:

function isPPC() {
return /PPC/.test(navigator .appVersion);
}
if(isPPC()) {
document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?subject\=Take a
look at website I found.?body=You can see this website at
http://www.BrokerAgent Training.com\" onMouseOver="wi ndow.status=\'S end your
friends e-mail about this website\'; return true" TITLE="Send your friends
e-mail about this website">this website<\/A> to a friend</b>');
}
Try setting our your code with clear 'blocking' to make errors easier
to detect.

document.write(
'<b>Send <A CLASS="contact" HREF="mailto:?s ubject=Take a',
' look at website I found.?body=You can see this website at',
' http://www.BrokerAgent Training.com\" ',
' onMouseOver="wi ndow.status=\'S end your friends e-mail',
' about this website\'; return true;"',
' TITLE="Send your friends an e-mail about this website">',
' this website<\/A> to a friend<\/b>'
);
else { document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?body\=Take
a look at this website I found. You can see this website at
http://www.BrokerAgent Training.com\" onMouseOver="wi ndow.status=\'S end your
friends e-mail about this website\'; return true" TITLE="Send your friends
e-mail about this website">this website<\/A> to a friend</b>');
document.write(
'<b>Send <A CLASS="contact" HREF=\"mailto:\ ?body\=Take a',
' look at this website I found. You can see this website at',
' http://www.BrokerAgent Training.com\" ',
' onMouseOver="wi ndow.status=\'S end your friends e-mail',
' about this website\'; return true"',
' TITLE="Send your friends e-mail about this website">',
' this website<\/A> to a friend<\/b>'
);
}
// End -->
</script>


Here's a different approach: put the two options in your page so that
they both display. Wrap each in a div and give them an ID. Now make
one disappear (say the one for PPC true) by setting its enclosing div's
display to 'none'.

Run your test in a script element just after the links or as a body
onload event. If PPC is true, change the hidden div's display to ''
and the other to 'none', e.g. (please excuse wrapping of long attribute
values, it should still cut 'n paste as source code just fine)
<div id="forPPC" style="display: none;"><b>Send <A CLASS="contact"
HREF="mailto:?s ubject=Take a look at website I found.&body=You can
see this website at http://www.BrokerAgent Training.com"
onMouseOver="
window.status=' Send your friends e-mail about this website';
return true;"
TITLE="Send your friends an e-mail about this website" this website</A> to a friend (PPC)</b></div>
<div id="forOther">< b>Send <A CLASS="contact"
HREF="mailto:?s ubject=Take a look at website I found.&body=You can
see this website at http://www.BrokerAgent Training.com"
onMouseOver="
window.status=' Send your friends e-mail about this website';
return true;"
TITLE="Send your friends an e-mail about this website" this website</A> to a friend (non-PPC)</b></div>


<script type="text/javascript">
if ( /PPC/.test(navigator .appVersion)
&& document.getEle mentById
&& document.body.s tyle ) {
document.getEle mentById('forPP C').style.displ ay = '';
document.getEle mentById('forOt her').style.dis play = 'none';
}
</script>
If all goes to plan, 'PPC' users with JavaScript enabled and honest
browsers will see the first A and maybe when they click on it their
e-mail client will start with your parameters. In any other case,
provided the style object & display property are supported, only the
second A will be shown.

--
Rob
Jul 23 '05 #4
Steve Horrillo wrote:
I can't figure out why this script won't insert the subject in the email [snip] if(isPPC()) {
document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?subject\=Take a [snip] }
else { document.write( '<b>Send <A CLASS="contact" HREF=\"mailto:\ ?body\=Take [snip] }


The "else" part of the script doesn't try to set a subject line -- it only
tries to set a body.

So unless your browser contains "PPC" in its user-agent string (which I
think only some old versions of Internet Explorer for Mac do), you will
get an empty subject line.

It's a stupid script anyway. You should be doing this server-side.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #5
Any places to learn how to do it or pick up a script to do it the
"non-stupid" way?

Warmest regards,

Steve Horrillo
http://stephenhorrillo.com

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #6
The bottom line is, I need is a row of three buttons together
(preferably horizontally placed) linked to a "Send to a Friend, Bookmark
This Site, and Make Us Your Home Page script all in one. I've been
amaturishly trying to combine scripts to accomplish this. There must be
one like that already written but I can't it.

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #7
Lee
Stephen Horrillo said:

The bottom line is, I need is a row of three buttons together
(preferably horizontally placed) linked to a "Send to a Friend, Bookmark
This Site, and Make Us Your Home Page script all in one. I've been
amaturishly trying to combine scripts to accomplish this. There must be
one like that already written but I can't it.


Those are possibly the top three things that Javascript in web pages
should NOT try to do. Sending email should be done from the server.
Adding bookmarks and setting the home page should be done manually
by the user. User who doesn't know how to do them for themselves
are probably not capable of deciding whether it's a good idea to do
and are likely to be dissatisfied with the results.

Jul 23 '05 #8
"microchip" <ve***********@ gmail.com> writes:
1. "<!----- Begin" is an invalid javascript function. It should have
the slashes in front of it (like the end).
He wrote "<!-- Begin". That is at least a valid HTML comment starter.

There is no reason to have "<!--" in the script element at all, so it
should not be commented, just removed.

If it is not removed, it must be assumed that the author intends it to
work as an HTML comment for browsers not understanding that the script
element content should not be rendered (which includes pretty much no
browser newer than Netscape 2). For that purpose, there should not be
anything outside of the HTML comment, so there should not be slashes
in front of it.
3.Towards the end you put "<\/a>" instead of </a>


That is correct. You should always escape the sequence "</" when
it occurs inside a script element. He should do the same for "</b>".

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #9
Steve Horrillo wrote:
I can't figure out why this script won't insert the subject in the email and
why can't I control the font and size being used? I'm not sure where to post
this. Let me know where if this is OT.
<SCRIPT LANGUAGE="JavaS cript">

<snip>

What has this to do with Java whatsoever?

Possibly this?

http://smjg.port5.com/faqs/web/js/javaisnotjs.html

Stewart.

--
My e-mail is valid but not my primary mailbox. Please keep replies on
the 'group where everyone may benefit.
Jul 23 '05 #10

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

Similar topics

3
6950
by: mihir | last post by:
does any one have a clue as to how to send a mail via jsp/servlets.
3
3348
by: Erik T. Nomad | last post by:
I've created a link that will enable the reader of any page on my website to click it, enter an e-mail address, and have it arrive in that inbox with a hyperlink to the site. However, I'm wondering if there's a way to customize it further, such that the hyperlink they are sent is the web address of the page the "send to friend" link was on. I don't want to convert my entire site over to .asp, so having a pop-up .asp page seems to make...
12
3251
by: Bryan Parkoff | last post by:
CMain Class is the base class that is initialized in main function. CA Class is the base class that is initialized in CMain::CMain(). CMain Class is always public while CA Class is always private. I have placed "friend void CA::Run_A(void)" in CMain Class. CMain::Run() function attempts to execute CA::Run_A(), but compiler shows an error saying that it is the violation to access private function. I don't understand why because friend...
10
4333
by: Der Andere | last post by:
I've got a problem concerning the << operator. Although I've declared it as a friend function it cannot access the private member of the class AVLtree. Some code: ------------------ class AVLtree { public: friend ostream& operator << (ostream& os, AVLtree& t){}; .... some unimportant stuff ...
2
1961
by: Pablo | last post by:
Hi at all! How can i send a DATA (not a DataTime) Type to a Java WebService? In .NET we have only a DataTime that is incompatible with the Data (calendar) Type of Java! How can i resolve this problem? I can't modify the java web-service and i need to send a simple data!!! AAARGH :P Help me! Tnx at all!
1
4650
by: krndhi1983 | last post by:
Hi to All, I am using Windows XP running IIS 6.0.I am developing a project using vb.net 1.1 with SQL Server 2000.It is a mobile project.So i am also using Pocket PC 2002 with SQL CE 2.0.When I want to Pull the table from SQL Server 2000 to SQL CE the following error will be occured. The Error is the request to send data to the computer running IIS has failed. for more information see HRESULT.MS Active Sync4.0 also been installed in my...
3
3074
by: shybe | last post by:
Ok, Im trying to create a "send this article to a friend" script for my blog, Right now its sending all the articles, but I want it to only send the article in which the form is attached to.
2
3835
by: btcoder | last post by:
Hi, my jsp page uses sun.net.smtp.SmtpClient to send email. It worked fine until the hosted location was moved to another server. Now it generates the sun.net.smtp.SmtpProtocolException and the hosting company can't find what's wrong with it so I'm here hoping somebody can help. The hosting company tried sending email from the server and it was okay and found no restrictions that prevents my page to access the smtp server. What could cause...
1
3129
by: sj7272 | last post by:
Hi, I am building email marketing framework, my email templates go out to clients and I wish to include a "send to a friend" or "forward to a friend" link in the outbound email. I want to track the numbers that take this option, which is no problem, I would just like some guidance on the php mail component of the scripting as I can grab code snippets for the web landing page form. Any guidance appreciated. Thx, Simon
0
8798
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8706
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9073
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7947
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6632
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5946
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4719
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.