Здравствуйте, gluck.
Вы писали 16 сентября 2004 г., 17:47:12:
gmsr> Здравствуйте!
gmsr> У меня такой вопрос:
gmsr> У меня есть такой скрипт:
gmsr> <script language="javascript">
gmsr> <!--
gmsr> document.write ("<");
gmsr> document.write ("a href=mai");
gmsr> document.write ("lto");
gmsr> document.write (":");
gmsr> document.write ("admin");
gmsr> document.write ("@");
gmsr> document.write ("reportal");
gmsr> document.write (".");
document.write ("ru>>");
gmsr> document.write ("admin");
gmsr> document.write ("@");
gmsr> document.write ("reportal");
gmsr> document.write (".");
gmsr> document.write ("r");
gmsr> document.write ("u");
gmsr> document.write ("</a>");
//-->>
gmsr> </script>
gmsr> Но в результате на странице выводится не ссылка а код этой ссылки (вероятно
gmsr> эти коды типа &#xx для этого и предназначены).
gmsr> Есть ли какие-либо средства JavaScript для преобразование Ascii кода в
gmsr> символ?
gmsr> библиотекa сайтостроительства http://www.i2r.ru/static/244/
gmsr> http://subscribe.ru/ http://subscribe.ru/feedback
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<HEAD>
<link rel="stylesheet" type="text/css" href="moggies_ss.css">
<title>Anti-Spam E-mail Encoder</title>
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<script language="JavaScript" type="text/javascript">
function UpdateLinks() {
if(document.aelgwase.addy.value.indexOf('@') == -1) {
alert('Required:\nEmail "To:" Address\n\nFormat:\nna***@d*****.com');
document.aelgwase.html.value = '';
document.aelgwase.text.value = '';
return false;
}
var s = UpdateHTML();
document.aelgwase.html.value = s;
s = UpdateText();
document.aelgwase.text.value = s;
return true;
}
function UpdateHTML() {
var s = GenerateURL();
s = '<a href="' + s + '">';
if(document.aelgwase.link.value.search(/\w/) != -1) {
var ss = document.aelgwase.link.value;
if((ss.indexOf('@') > -1) && (document.aelgwase.anti.checked == true))
{ ss = EncodeString(ss); }
s = s + ss;
}
else { s = s + 'E-mail'; }
s = s + '</a>';
return s;
}
function UpdateText() {
var s = GenerateURL();
return s;
}
function GenerateURL() {
var s = document.aelgwase.addy.value.replace(/ /g,'');
s = 'mailto:' + s;
if(document.aelgwase.anti.checked == true) { s = EncodeString(s); }
var first = true;
if(document.aelgwase.cc.value.indexOf('@') > -1) {
s = s + '?CC=';
first = false;
var ss = document.aelgwase.cc.value.replace(/ /g,'');
ss = ss.replace(/\"/g,'%22');
if(document.aelgwase.anti.checked == true) { ss = EncodeString(ss); }
s = s + ss;
}
if(document.aelgwase.bcc.value.indexOf('@') > -1) {
if(first == true) { s = s + '?BCC='; }
else { s = s + '&BCC='; }
first = false;
var ss = document.aelgwase.bcc.value.replace(/ /g,'');
ss = ss.replace(/\"/g,'%22');
if(document.aelgwase.anti.checked == true) { ss = EncodeString(ss); }
s = s + ss;
}
if(document.aelgwase.sub.value.search(/\w/) != -1) {
if(first == true) { s = s + '?Subject='; }
else { s = s + '&Subject='; }
first = false;
var ss = document.aelgwase.sub.value.replace(/\%/g,'%25');
ss = ss.replace(/ /g,'%20');
ss = ss.replace(/\"/g,'%22');
ss = ss.replace(/\&/g,'');
ss = ss.replace(/\;/g,'%3B');
ss = ss.replace(/\=/g,'');
ss = ss.replace(/\?/g,'');
s = s + ss;
}
if(document.aelgwase.body.value.search(/\w/) != -1) {
if(first == true) { s = s + '?body='; }
else { s = s + '&body='; }
first = false;
var ss = document.aelgwase.body.value.replace(/\%/g,'%25');
ss = ss.replace(/ /g,'%20');
ss = ss.replace(/\"/g,'%22');
ss = ss.replace(/\&/g,'');
ss = ss.replace(/\;/g,'%3B');
ss = ss.replace(/\=/g,'');
ss = ss.replace(/\?/g,'');
ss = ss.replace(/\n/g,'%10');
ss = ss.replace(/\r/g,'%13');
s = s + ss;
}
return s;
}
function EncodeString(s) {
var ss = '';
for( i = 0; i < s.length; i++) {
var fs = s.charCodeAt(i);
ss = ss + '&#' + fs + ';';
}
return ss;
}
function DemoGeneratedLink() {
var pDemo = window.open('','','height=200,width=400,scrollbars=yes,resizable=yes');
pDemo.document.writeln('<html><body bgcolor="white" onBlur="self.close()">');
pDemo.document.writeln('<TABLE WIDTH="100%" HEIGHT="100%" BORDER="0" CELLPADDING="0"
CELLSPACING="0">');
pDemo.document.writeln('<TR><TD WIDTH="100%" HEIGHT="100%" ALIGN="CENTER" VALIGN="MIDDLE"><br><br><br>');
pDemo.document.writeln(document.aelgwase.html.value);
pDemo.document.writeln('<br> <form><input type=button onClick="self.close()"
value="Close Window"><\/form>');
pDemo.document.writeln('</TD></TR></TABLE>');
pDemo.document.writeln('<\/body><\/html>');
}
</script>
</HEAD>
<body bgcolor="#f5f5dc" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<a name="top"></a>
<font face="ariel, verdana, helvetica" size=2>
<p><div align="center"><a href="index.html">Back to Moggies</a><br><br><h3>Advanced
E-mail Link Generator<br>With Anti-Spam Encoder</h3></div></p>
<p><div align="center"><table width="80%">
<tr>
<td><font face="ariel, verdana, helvetica" size=2>The "Advanced
mail Link Generator with Anti-Spam Encoder" will generate mailto: links
you can copy and paste into your web pages and e-mails. The Anti-Spam Encoder
is an encoding scheme designed to cloak e-mail addresses from spammer's e-mail
harvesting robots, yet be visible and readable for your site visitors.<br><br>Fill
in only those form fields that are applicable for your application.<br><br>Advanced
E-mail Link Generator with Anti-Spam Encoder:</font><br><br>
<div align="center"><form name="aelgwase">
<table cellSpacing="0" cellPadding="3" width="475" border="0">
<tr>
<td align="right"><font face="ariel, verdana, helvetica" size=2>E-mail
"To:" Address:</font></td>
<td><input onchange="UpdateLinks()" size="27" name="addy"></td>
</tr>
<tr>
<td align="right"><font face="ariel, verdana, helvetica" size=2>E-mail
"CC:" Address:</font></td>
<td><input onchange="UpdateLinks()" size="27" name="cc"></td>
</tr>
<tr>
<td align="right"><font face="ariel, verdana, helvetica" size=2>E-mail
"BCC:" Address:</td>
<td><input onchange="UpdateLinks()" size="27" name="bcc"></td>
</tr>
<tr>
<td align="right"><font face="ariel, verdana, helvetica" size=2>E-mail
Subject:</font></td>
<td><input onchange="UpdateLinks()" size="27" name="sub" value=""></td>
</tr>
<tr>
<td vAlign="top" align="right"><font face="ariel, verdana, helvetica"
size=2>E-mail Body Text:<br><br>Type in the text you want in the Body of the
e-mail. </font></td>
<td><textarea name="body" rows="5" cols="25" onchange="UpdateLinks()"></textarea></td>
</tr>
<tr>
<td align="right"><nobr><font face="ariel, verdana, helvetica" size=2>Employ Anti-Spam Encoding?</font></nobr></td>
<td><input onclick="UpdateLinks()" type="checkbox" value="yes" checked="true"
name="anti"></td>
</tr>
<tr>
<td align="right"><font face="ariel, verdana, helvetica" size=2>Text
Link (for HTML links, such as an e-mail address or "Click Here"): <br>What
do you want your e-mail link to say? (Default is: E-mail) You might want to consider
Click Here or your name instead. Type what you want in the box.</font></td>
<td><input onchange="UpdateLinks()" size="27" name="link"></td>
</tr>
<tr>
<td colSpan="2"><hr><br><br><font face="ariel, verdana, helvetica" size=2><h4>Generated
Links:</h4><br>The "Generated HTML Link" can be copied and pasted into
your HTML web page or HTML e-mail.<br><br>Generated HTML Link:<br><input size="57"
name="html"><br><br>The "Generated Plain Text Link" can be used in
your plain text e-mail.<br><br>Generated Plain Text Link:<br><input size="57"
name="text"><br><br><a href="javascript:DemoGeneratedLink()">(View in popup window)</a></font><br><br>
<div align="center"><input onclick="UpdateLinks()" type="button" value="Update
Generated Links"></div>
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table></div></p>
<p><div align="center"><a href="index.html">Back to Moggies</a></div></p>
<p align=right><a href="#top"><img src="catguide/images/purtop.gif" alt="Return
to top of page" border="0" width=32 height=32></a></p>
</font>
</BODY>
</HTML>