---
title: "XHTMLvalid och spamskyddad e-postadress"
type: "forum-thread"
url: "https://www.webforum.nu/amne/html-css/103505-xhtmlvalid-och-spamskyddad-e-postadress"
topic: "HTML & CSS"
topic_url: "https://www.webforum.nu/amne/html-css"
author: "cyprys"
published: "2004-05-13T13:05:51.000Z"
updated: "2004-05-13T13:27:53.000Z"
replies: 2
views: 320
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/html-css/103505-xhtmlvalid-och-spamskyddad-e-postadress"
---

# XHTMLvalid och spamskyddad e-postadress

## #1 — cyprys, 2004-05-13T13:05Z

Använder denna kod just nu för att "skydda" från spamrobotarna.

```
"document.write('<a href=\""mailto:' + 'info' + '@' + 'cyprys.com' + '\"">info' + '@' + 'cyprys.com' + '</a>');"
```

Denna blir tyvärr inte Xhtml-valid så jag tänkte höra vilket sätt man skulle kunna läsa detta på?

> **valideraren skrev:**
>
> Below are the results of attempting to parse this document with an SGML parser.
> 
>    1\.
> 
>       Line 31, column 146: an attribute value must be a literal unless it contains only name characters
> 
>       .../javascript"\> document.write('\<a href=\\"mailto:' + 'info' + '@' + 'cyprys.com
>    2\.
> 
>       Line 31, column 157: character "+" not allowed in attribute specification list
> 
>       ..."\> document.write('\<a href=\\"mailto:' + 'info' + '@' + 'cyprys.com' + '\\"\>inf
>    3\.
> 
>       Line 31, column 157: document type does not allow element "a" here
> 
>       ..."\> document.write('\<a href=\\"mailto:' + 'info' + '@' + 'cyprys.com' + '\\"\>inf

Permalänk: https://www.webforum.nu/p/103505

## #2 — Peter S, 2004-05-13T13:16Z

Eftersom XML inte tillåter vissa tecken utanför CDATA-sektioner får du göra så här:

```
<script type="text/javascript">
//<![CDATA[

/* Din kod */

//]]>
</script>
```

 :)

Permalänk: https://www.webforum.nu/p/1345510

## #3 — cyprys, 2004-05-13T13:27Z

Det där gjorde susen. ;) 
Tackar så mycket!

Permalänk: https://www.webforum.nu/p/1345523

---

Tråden på webben: https://www.webforum.nu/amne/html-css/103505-xhtmlvalid-och-spamskyddad-e-postadress
