下面是参考代码
代码语言:javascript复制<!DOCTYPE HTML>
<html>
<body>
<form action=”/example/html5/demo_form.asp” method=”get”>
Name: <input type=”text” name=”usr_name”
oninput=”setCustomValidity(”);” required oninvalid=”setCustomValidity(‘Please enter the username’);”
/>
<input type=”submit” value=”提交” />
</form>
</body>
</html>