发送给朋友和Java问题 [英] Send to A Friend And Java Problem

查看:74
本文介绍了发送给朋友和Java问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚为什么这个剧本不会在电子邮件中插入主题和

为什么我不能控制使用的字体和大小?我不知道在哪里张贴

这个。如果这是OT,请告诉我。

< SCRIPT LANGUAGE =" JavaScript">

<! - 开始

function isPPC(){

if(navigator.appVersion.indexOf(" PPC")!= -1)return true;

else return false;

}

if(isPPC()){

document.write(''< b> Send< A CLASS =" contact" HREF = \mailto:\?subject \ =拿一个

查看我找到的网站.?body=你可以看到这个网站

http:// www.BrokerAgentTraining.com \" onMouseOver =" window.status = \''发送您的

朋友关于此网站的电子邮件\'';返回trueTITLE ="发送你的朋友

发送电子邮件到这个网站">这个网站< \ / A>给朋友< / b>'');

}

else {document.write(''< b> Send< A CLASS =" contact" HREF = \" mailto:\?body \ = Take

a看看这个网站我你可以看到这个网站

http://www.BrokerAgentTraining.com\" onMouseOver =" window.status = \''发送你的

朋友关于这个网站的电子邮件\''; 返回真实 TITLE ="发送你的朋友

关于这个网站的电子邮件">这个网站< \ / A>给朋友< / b>'');

}

//结束 - >

< / script>

-

最热烈的问候,


Steve Horrillo,房地产经纪人/首席执行官/ C.Ht.
http://brokeragenttraining.com (房地产高级培训

专业人士) http://over100percent.com (房地产经纪人赚取超过100%

http :: / hipfsbo.com(对于严肃的家庭卖家或买家来说,这是一个很有用的地方

对新想法持开放态度)

解决方案

1。"<!----- Begin"是一个无效的javascript函数。它应该有

前面的斜杠(比如结尾)。


2. mailto addy中的斜线不应该在那里。


3.向你放置的结尾< \ / a>"而不是< / a>


4.你应该查看
http://msdn.microsoft.com/library/de...ned/mailto.asp

我发现它非常有帮助。


l8r


Steve Horrillo写道:

我不明白为什么这个剧本不会在电子邮件中插入主题和
为什么我不能控制使用的字体和大小?我不知道在哪里发布这个。如果这是OT,请告诉我。

< SCRIPT LANGUAGE =" JavaScript">
<! - 开始
函数isPPC(){
if(navigator.appVersion.indexOf(" PPC")!= -1)返回true;
else返回false;
}
if(isPPC()){
document.write(''< b> Send< A CLASS =" contact" HREF = \" mailto:\?subject \ =看看我找到的网站。?body =你可以在这个网站上看到这个网站
http://www.BrokerAgentTraining.com \" onMouseOver =" window.status = \''发送你的
朋友关于这个网站的电子邮件\ ''; return true" TITLE ="发送你的朋友
发送电子邮件到这个网站">这个网站< \ / A>给朋友< / b>'');
}
else {document.write(''< b> Send< A CLASS =" contact" HREF = \" mailto:\?body \ =看看
看看这个我找到了一个网站。你可以在
http://www.BrokerAgentTraining上看到这个网站.com\onMouseOver =" window.status = \''发送给您的朋友发送关于这个网站的电子邮件'\\''; 返回真实 TITLE =发送你的朋友
关于这个网站的电子邮件>这个网站< \ / A>给朋友< / b>'');
}
//结束 - >
< / script>




你的JavaScript引用了我的朋友的问题。我在使用引号编写带有引号的复杂字符串时的建议是在缓冲区变量中构建字符串

位。调试要容易得多。


var buf =''< b> Send< A CLASS =" contact" HREF =" mailto:?subject =拿一个'';

buf + =''查看我发现的网站。& body =你可以看到这个网站'';

buf + =''http://www.BrokerAgentTraining.com" onMouseOver =" window.status ='';

buf + ="''发送你的朋友关于这个网站的电子邮件''; return true" ;;

buf + =''" TITLE =发送你的朋友关于这个网站的电子邮件>这个

网站< / a>给朋友< / b>'';

document.write(buf);


此外,mailto链接不可靠,并非所有客户都会填写

的身体...


来自主题的分隔符应该是''&'''不'?'''br />
" mailto:em *** @ bogus.com?subject=Some subject& body =你的正文


最后这是一个JavaScript,而不是Java问题。


-

保重,


Jonathan

- -----------------

LITTLE WORKS STUDIO
http://www.tittleWorksStudio.com


Steve Horrillo写道:

我可以我们弄清楚为什么这个剧本不会在电子邮件中插入主题和
为什么我不能控制使用的字体和大小?我不知道在哪里发布


哪个字体和大小?在电子邮件或页面上?一个''mailto''是

使用body,另一个是主题。这是有意的吗?否则,他们

似乎做了完全相同的事情。


如果你的意思是在电子邮件中,你只有
电子邮件客户端,你不知道那是什么,什么是支持或

,即使配置了一个。所以你运气好,这个

将会起作用。


我不知道为什么你甚至在测试''PPC''导航器

appName字符串,但这里有...

这个。如果这是OT,请告诉我。

< SCRIPT LANGUAGE =" JavaScript">


语言属性已折旧,类型是必需的:


< script type =" text / javascript">

<! - 开始


隐藏脚本元素内容是不必要的并且可能有害 -

不要这样做。

函数isPPC(){
if(navigator.appVersion.indexOf(" PPC")!= -1)return true;


依靠浏览器告诉你

老实说这是什么平台是非常不可靠的。接受一个好的

的时间百分比是错误的(但这可能不是这个

案例的真正问题)。


检测''PPC''有什么意义?

否则返回false;
}


更简单(尽管没有)更准确)功能是:


函数isPPC(){

返回/PPC/.test(navigator.appVersion);

}

if(isPPC()){
document.write(''< b> Send< A CLASS =" contact" HREF = \" mailto:\\ \\?subject \ =看看我找到的网站。人们可以看到这个网站
http://www.BrokerAgentTraining.com \" onMouseOver =" window。 status = \''发送给朋友的电子邮件关于这个网站\'';返回trueTITLE =发送你的朋友
关于这个网站的电子邮件">这个网站< \ / A>给朋友< / b>'');
}


尝试设置我们的代码,清楚''阻止''使错误更容易

来检测。


document.write(

''< b>发送< ;一个CLASS =联系人 HREF =" mailto:?subject =拿一个'',

''查看我找到的网站.?body=你可以看到这个网站'',

''http://www.BrokerAgentTraining.com\" '',

''onMouseOver =" window.status = \''发送给朋友的电子邮件'',

''关于这个网站'\\'' ;返回true;"'',

''TITLE ="发送给你的朋友一封关于这个网站的电子邮件">'',

''这个网站< ; \ / A>给朋友< \ / b>''

);

else {document.write(''< b> Send< A CLASS =" contact" ; HREF = \" mailto:\?body \ =看看我找到的这个网站。你可以看到这个网站
http://www.BrokerAgentTraining.com \ " onMouseOver =" window.status = \''发送给您的
好友发送电子邮件关于这个网站\'';返回trueTITLE ="发送您的朋友
发送电子邮件至本网站>此网站< \ / A>给朋友< / b>'');


document.write(

''< b> Send< A CLASS =" contact" HREF = \" mailto:\ ?body\ =在我找到的这个网站上看一下'',

''你可以看到这个网站'',

''http:// www.BrokerAgentTraining.com \"'',

''onMouseOver =" window.status = \''发送你的朋友的电子邮件'',

''关于这个网站\'';返回true''',

''TITLE ="发送你的朋友关于这个网站的电子邮件">'',

''这个网站< \ / A>给朋友< \ / b>''

);

}
//结束 - >
< / script>


这是一种不同的方法:将两个选项放在页面中,以便

他们都显示。将每个包裹在div中并为其提供ID。现在通过将其封闭的div'的'b $ b显示设置为''none'来消失(比如说PPC为真的那个)。


在链接之后或作为正文$ / b $ b onload事件的脚本元素中运行测试。如果PPC为真,则将隐藏的div'的显示更改为''''

,将另一个显示更改为''none'',例如(请原谅长属性

值的包装,它应该仍然可以作为源代码剪切'

< div id =" forPPC" style =" display:none;">< b> Send< A CLASS =" contact"

HREF =" mailto:?subject =看看我发现的网站。& body =你可以

看到这个网站http://www.BrokerAgentTraining.com"

onMouseOver ="

window .status =''发送你的朋友发送关于这个网站的电子邮件'';

返回true;"

TITLE ="发送给你的朋友一封电子邮件这个网站这个网站< / A>给朋友(PPC)< / b>< / div>


< div id =" forOther">< b> Send< A CLASS =" contact"

HREF =" mailto :?subject =看看我找到的网站。& body =你可以

在http://www.BrokerAgentTraining.com上查看这个网站。

onMouseOver =

window.status =''发送你的朋友发送关于这个网站的电子邮件'';

返回true;"

TITLE =向您的朋友发送有关此网站的电子邮件这个网站< / A>给朋友(非PPC)< / b>< / div>



< script type =" text / javascript">

if(/PPC/.test(navigator.appVersion)

&& document.getElementById

&& document.body.style) {

document.getElementById(''forPPC'')。style.display ='''';

document.getElementById(''forOther'')。style。 display =''none'';

}

< / script>

如果一切按计划进行,''PPC''用户启用JavaScript并且诚实

浏览器将看到第一个A,也许当他们点击它们时,他们的

电子邮件客户端将从您的参数开始。在任何其他情况下,

提供了样式对象&支持显示属性,只显示

秒A..


-

Rob


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="JavaScript">
<!-- Begin
function isPPC() {
if (navigator.appVersion.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.BrokerAgentTraining.com\" onMouseOver="window.status=\''Send 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.BrokerAgentTraining.com\" onMouseOver="window.status=\''Send 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)

解决方案

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


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="JavaScript">
<!-- Begin
function isPPC() {
if (navigator.appVersion.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.BrokerAgentTraining.com\" onMouseOver="window.status=\''Send 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.BrokerAgentTraining.com\" onMouseOver="window.status=\''Send 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:?subject=Take a'';
buf+=''look at website I found.&body=You can see this website at'';
buf+='' http://www.BrokerAgentTraining.com" onMouseOver="window.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***@bogus.com?subject=Some subject&body=Your body text"

Lastly this is a JavaScript, not Java problem.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


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="JavaScript">
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.appVersion.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.BrokerAgentTraining.com\" onMouseOver="window.status=\''Send 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:?subject=Take a'',
'' look at website I found.?body=You can see this website at'',
'' http://www.BrokerAgentTraining.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<\/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.BrokerAgentTraining.com\" onMouseOver="window.status=\''Send 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.BrokerAgentTraining.com\" '',
'' onMouseOver="window.status=\''Send 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:?subject=Take a look at website I found.&body=You can
see this website at http://www.BrokerAgentTraining.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:?subject=Take a look at website I found.&body=You can
see this website at http://www.BrokerAgentTraining.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.getElementById
&& document.body.style ) {
document.getElementById(''forPPC'').style.display = '''';
document.getElementById(''forOther'').style.display = ''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


这篇关于发送给朋友和Java问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆