简体   繁体   English

W3 HTML表单验证

[英]W3 Validation of HTML form

When im trying to validate my page on http://validator.w3.org/ i get one error that says 当我尝试验证我在http://validator.w3.org/上的页面时,出现一个错误提示

Line 118, Column 44: there is no attribute "onClick" 第118行,第44列:没有属性“ onClick”

But when I change the onClick to just onclick i get about 40 new errors and almous al of them is complaining about the character, they want me to change the caracters to the HTML format, but If i do that my PHP script stop working. 但是,当我将onClick更改为onclick时,我遇到了大约40个新错误,其中许多人抱怨该字符,他们希望我将这些字符更改为HTML格式,但是如果我这样做,我的PHP脚本将停止工作。

This is one of the rows that the validator is complaning about after I change onClick to onclick 这是我将onClick更改为onclick之后验证器抱怨的行之一。

<input type="text" name="enterprise" id="enterprise" value="<?php echo isset($_POST['enterprise']) ? $_POST['enterprise'] : '' ?>" />

and this is my onclick string 这是我的onclick字符串

<input type="button" value="Clear" onclick="window.location.reload();return false" />

Is there another way I can reload the page or how can I write the input type php scrip so it validates. 还有另一种方法可以重新加载页面,或者如何编写输入类型php scrip以便进行验证。

Thanks in advance 提前致谢

the W3 validator will complain if it finds any language it doesn't recognize and it's not normal in a webpage, such as php. 如果W3验证程序发现任何无法识别的语言并且在php之类的网页中不正常,它将抱怨。 You should pass your page trough a php server and then copy the final HTML in the validator. 您应该将页面通过php服务器,然后在验证器中复制最终的HTML。

There is 3 Method to do it with Html/JS, 使用Html / JS的方法有3种,

<input type="button" value="Reload" onClick="window.location.reload()"/>
<input type="button" value="Reload" onClick="history.go(0)"/>
<input type="button" value="Reload" onClick="window.location.href=window.location.href"/>

Notice: You can use AJAX technology to refresh page without reloading all elements like images, css files...etc. 注意:您可以使用AJAX技术刷新页面,而无需重新加载所有图像,css文件等元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM