simple masking Problem with Javascript inside an Makro Options
thahammer
Posted: Wednesday, March 05, 2008 11:17:47 AM

Rank: Aficionado

Joined: 8/28/2007
Posts: 129
Location: Bavaria
I treid to make my E-Mails Spamsicher with this Javascriptcode.

Code:

<script type="text/javascript">
var Satz = '<xsl:value-of select="data [@alias = 'E-Mail']" disable-output-escaping="yes"/>';
var Woerter = Satz.split("@");
document.write("<a href='mailto:\" + Woerter[0] + \"@" + Woerter[1]\"'>E-Mail</a><br/>");
</script>


i get the E-Mail with an Textfield from my Site, split it and give it Back as an Javascript String. That´s the Plan.

But i have an masking Probleme in my document.write!
Can somebody help me? I don´t frind my Error right now, but i need it! :blush:

I Love umbraco
neehouse
Posted: Wednesday, March 05, 2008 12:07:42 PM

Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,074
Location: Charleston, West Virginia, United States
I think I follow what you are asking... try this...


Code:

<script type="text/javascript">
var Satz = '<xsl:value-of select="data [@alias = 'E-Mail']" disable-output-escaping="yes"/>';
var Woerter = Satz.split("@");
document.write('<a href="mailto:' + Woerter[0] + '@' + Woerter[1] + '">E-Mail</a><br/>');
</script>


you may have to escape the double quotes...

• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
thahammer
Posted: Wednesday, March 05, 2008 12:54:33 PM

Rank: Aficionado

Joined: 8/28/2007
Posts: 129
Location: Bavaria
I was looking in an old Javascript and found something similar. Now i changed it to this:

Code:

<script type="text/javascript">
var Satz = '<xsl:value-of select="data [@alias = 'E-Mail']" disable-output-escaping="yes"/>';
var Woerter = Satz.split("@");
emailE = (Woerter[0] + '@' + Woerter[1]);
document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>');
</script>


And this one is working and do what i want!

I Love umbraco
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.