本文介绍了html5验证表单标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



老实说,我不明白标记有什么问题。我已经浏览了很多W3的网站,但无法得到它。



帮助?



HTML:

 < form action =process.phpmethod =post> 
< div>
< label for =name>名称< / label>< br />
< input type =textvalue =name =name/>
< / div>
< div>
< label for =email>电子邮件< / label>< br />
< input type =textvalue =name =email/>
< / div>
< div>
< label for =message> Message< / label>< br />
< textarea name =messagecols =30rows =4>< / textarea>
< / div>
< div>
< input type =checkboxvalue =yesname =newsletter/>
< label for =newsletter>订阅电子报< / label>
< / div>
< div>
< input type =submitvalue =Submitname =subscribe/>
< / div>
< / form>


解决方案

您错过了 id 属性。



所以要解决它,例如:

 < input type =textvalue =name =emailid =email/> 

就是这样。


"The for attribute of the label element must refer to a form control."

Honestly, I don't understand what's wrong with the markup. I've looked through so much of the W3's site and just can't get it.

Help?

HTML:

<form action="process.php" method="post">
    <div>
        <label for="name">Name</label><br />
        <input type="text" value="" name="name" />
    </div>
    <div>
        <label for="email">E-mail</label><br />
        <input type="text" value="" name="email" />
    </div>
    <div>
        <label for="message">Message</label><br />
        <textarea name="message" cols="30" rows="4"></textarea>
    </div>
    <div>
        <input type="checkbox" value="yes" name="newsletter" />
        <label for="newsletter">Subscribe to newsletter</label>
    </div>
    <div>
        <input type="submit" value="Submit" name="subscribe" />
    </div>
</form>
解决方案

You're missing the id attribute.

So to fix it, for example:

<input type="text" value="" name="email" id="email" />

That's it. Linky.

这篇关于html5验证表单标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:23