如何在 HTML5 中避免 HREF / MAILTO 的验证错误
How to avoid a validation error with HREF / MAILTO in HTML5
我正在使用 HTML5 并且收到验证错误 元素 a 上的属性 href 的值错误:方案数据中的非法字符:不允许 space 。来自 [https://validator.w3.org/nu/].
代码按预期运行,但我需要避免验证错误。
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset=utf-8>
<title>My Page Title</title>
</head>
<body>
<h1>My Page Header</h1>
<ul>
<li class="block_left_380_text_18">
Are you receiving our weekly Emails?
Please
<a href="mailto:myemail@hotmail.com&subject=Please add me to the Group
mailing list&body=This request comes from the link on the website's
home page.%0D%0A
My Name Is:%0D%0A
My Street Address is:%0D%0A
My City / State / Zip are:%0D%0A
My Primary Phone is:%0D%0A
My Primary Email (if different from the FROM field above):%0D%0A
Other members of my household:">Click Here</a>
to send an Email to myemail@hotmail.com to be included.
</li>
</ul>
</body>
</html>
我已经多次使用 MAILTO,但这是我第一次将它与 Body 参数一起使用。如您所见,body= 元素中有很多 space。如果我用 %20 替换所有 spaces,验证器会抱怨每行末尾的 $OD%OA。
我如何使用 HREF / MAILTO,其中正文有很多 space 和 CR/LF?
问题出在 HTML 编辑器 (Dreamweaver CS6) 中的选项卡和 returns 以提高可读性。似乎在使用 MAILTO 时:不能有格式选项卡或 returns。当我这样做时,我转义了所有斜杠、冒号等。通过 [https://validator.w3.org/nu/] 验证的代码。看起来像这样:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset=utf-8>
<title>My Page Title</title>
</head>
<body>
<h1>My Page Header</h1>
<ul>
<li class="block_left_380_text_18">
Are you receiving our weekly Emails?
Please
<a href=
"mailto:myemail@hotmail.com&subject=Please%20add%20me%20to%20the%20mailing%20list&body=This%20request%20comes%20from%20the%20link%20on%20the%20home%20page.%0D%0AMy%20Name%20Is%3A%0D%0AMy%20Street%20Address%20is%3A%0D%0AMy%20City%20%2F%20State%20%2F%20Zip%20are%3A%0D%0AMy%20Primary%20Phone%20is%3A%0D%0AMy%20Primary%20Email%20(if%20different%20from%20the%20FROM%20field%20above)%3A%0D%0AOther%20members%20of%20my%20household%3A">
Click Here
</a>
to send an Email to myemail@hotmail.com to be included.
</li>
</ul>
</body>
</html>
我正在使用 HTML5 并且收到验证错误 元素 a 上的属性 href 的值错误:方案数据中的非法字符:不允许 space 。来自 [https://validator.w3.org/nu/].
代码按预期运行,但我需要避免验证错误。
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset=utf-8>
<title>My Page Title</title>
</head>
<body>
<h1>My Page Header</h1>
<ul>
<li class="block_left_380_text_18">
Are you receiving our weekly Emails?
Please
<a href="mailto:myemail@hotmail.com&subject=Please add me to the Group
mailing list&body=This request comes from the link on the website's
home page.%0D%0A
My Name Is:%0D%0A
My Street Address is:%0D%0A
My City / State / Zip are:%0D%0A
My Primary Phone is:%0D%0A
My Primary Email (if different from the FROM field above):%0D%0A
Other members of my household:">Click Here</a>
to send an Email to myemail@hotmail.com to be included.
</li>
</ul>
</body>
</html>
我已经多次使用 MAILTO,但这是我第一次将它与 Body 参数一起使用。如您所见,body= 元素中有很多 space。如果我用 %20 替换所有 spaces,验证器会抱怨每行末尾的 $OD%OA。 我如何使用 HREF / MAILTO,其中正文有很多 space 和 CR/LF?
问题出在 HTML 编辑器 (Dreamweaver CS6) 中的选项卡和 returns 以提高可读性。似乎在使用 MAILTO 时:不能有格式选项卡或 returns。当我这样做时,我转义了所有斜杠、冒号等。通过 [https://validator.w3.org/nu/] 验证的代码。看起来像这样:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset=utf-8>
<title>My Page Title</title>
</head>
<body>
<h1>My Page Header</h1>
<ul>
<li class="block_left_380_text_18">
Are you receiving our weekly Emails?
Please
<a href=
"mailto:myemail@hotmail.com&subject=Please%20add%20me%20to%20the%20mailing%20list&body=This%20request%20comes%20from%20the%20link%20on%20the%20home%20page.%0D%0AMy%20Name%20Is%3A%0D%0AMy%20Street%20Address%20is%3A%0D%0AMy%20City%20%2F%20State%20%2F%20Zip%20are%3A%0D%0AMy%20Primary%20Phone%20is%3A%0D%0AMy%20Primary%20Email%20(if%20different%20from%20the%20FROM%20field%20above)%3A%0D%0AOther%20members%20of%20my%20household%3A">
Click Here
</a>
to send an Email to myemail@hotmail.com to be included.
</li>
</ul>
</body>
</html>