이 XHTML 양식이 검증되지 않는 이유는 무엇입니까?
-
05-07-2019 - |
문제
이것이 여기에서 검증되지 않는 이유는 무엇입니까?
http://validator.w3.org/#validate_by_input
양식 입력 태그가 잘못되었지만 XHTML 사양을 읽는 것은 정상을 검증해야합니다. 어떤 아이디어?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div class="Header">
<table class="HeaderTable">
<tr>
<td>
<div class="Heading">Test <span class="Standard">Test</span>
</div>
</td>
<td>
<div class="Controls">
<form id="ControlForm" method="get" action="Edit.php">
<input type="submit" name="action" id="Edit" value="Edit" />
<input type="submit" name="action" id="New" value="New" />
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
해결책
당신은 움직여야합니다
<div class="Controls">
그래서 내부에 그만큼 u003Cform 꼬리표
이것은 멋지게 검증됩니다
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div class="Header">
<table class="HeaderTable">
<tr>
<td>
<div class="Heading">Test <span class="Standard">Test</span></div>
</td>
<td>
<form id="ControlForm" method="get" action="Edit.php">
<div class="Controls">
<input type="submit" name="action" id="Edit" value="Edit" />
<input type="submit" name="action" id="New" value="New" />
</div>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>
다른 팁
a를 넣으십시오 fieldset
입력 주위에 태그를 지정하십시오. XHTML의 형태에 대한 아이디어는 Div, Fieldset 등이 아닌 직접 후손을 가질 수 없다는 것입니다.
다른 사람이 말한 것처럼 :
QUOTE] 유효성 검사기는 숨겨진 입력 요소가 즉시 양식 태그를 따라갈 수 없다고 말합니다. 어떤 종류의 컨테이너 요소가 있어야합니다. [/인용하다
(원천)
필드 세트가 도움이 될 수 있다고 생각합니다. 보다 XHTML DTD:
<!ELEMENT form %form.content;>
<!ENTITY % form.content "(%block; | %misc;)*">
<!ENTITY % misc "noscript | %misc.inline;">
<!ENTITY % misc.inline "ins | del | script">
<!ENTITY % block "p | %heading; | div | %lists; | %blocktext; | fieldset | table">
<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
<!ENTITY % lists "ul | ol | dl">
<!ENTITY % blocktext "pre | hr | blockquote | address">
당신을위한 입력 없음 :(
나는 똑같은 문제가 있었고 알아내는 데 시간이 걸렸습니다. 이것이 W3C 유효성 검사기의 최근 변화입니까? 과거에 양식이 검증 된 내 페이지 중 일부는 확신하지만 이제는 모두 같은 문제에 대한 오류가 발생하는 것 같습니다.
나는 항상 다음과 같은 일을 했었습니다.
<div>
<form>
<label></label>
<input />
<label></label>
<input />
<label></label>
<input />
</form>
유효성 검사 오류를 얻으므로 이제 모든 레이블과 입력 주위에 필드셋 또는 DIV를 추가하여 다음과 같이 검증 할 수 있습니다.
<div>
<form>
<fieldset>or<div>
<label></label>
<input />
<label></label>
<input />
<label></label>
<input />
</fieldset>or</div>
</form>
효과가있는 것 같지만 과거에 이것을 할 필요가 없다고 확신합니다 ... 흠?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div class="Header">
<table class="HeaderTable">
<tr>
<td>
<div class="Heading">Test <span class="Standard">Test</span>
</div>
</td>
<td>
<form id="ControlForm" method="get" action="Edit.php">
<div class="Controls">
<input type="submit" name="action" id="Edit" value="Edit" />
<input type="submit" name="action" id="New" value="New" />
</div>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>
당신의 div를 당신의 양식 안에 넣으십시오.
입력 요소는 필드 세트 내에 있어야합니다. 이는 비 시각 사용자 에이전트가 문서에 더 액세스 할 수 있도록하는 이점을 확인하고 추가 할 수 있습니다.
제쳐두고, 당신의 마크 업은 고통 받고 있습니다 divitis 약간. 당신은 그 안에있는 div 요소를 중첩하지 않고 직접 테이블 셀에 클래스를 넣을 수 있습니다 (레이아웃 테이블 사용에 대해서는 언급하지 않을 것입니다). 또한 DIV 내에 둥지를 틀지 않고 형태 요소를 직접 스타일링 할 수 있습니다.
어쨌든, 여기에 필드셋이 추가 된 예제가 있습니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div class="Header">
<table class="HeaderTable">
<tr>
<td>
<div class="Heading">Test <span class="Standard">Test</span></div>
</td>
<td>
<div class="Controls">
<form id="ControlForm" method="get" action="Edit.php">
<fieldset>
<input type="submit" name="action" id="Edit" value="Edit" />
<input type="submit" name="action" id="New" value="New" />
</fieldset>
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>